You haven’t shown us what it is you’re displaying in your RG, so we can’t definitively say what you’ve done wrong in terms of displaying field “Days overdue”. You’re likely just displaying the wrong thing, or your expression you’re using there is wrong. (It is also possible that your workflow that sets the “days overdue” field is not set up right.)
Note that what you are storing in your database as “Days overdue” is a text – it is not a number, nor a date and is of very limited use.
But first: Why would you need to do this? You don’t need to store this value in your database as, from a display perspective, you always know when a task is overdue.
Three things to know:
-
A task is overdue if its due date is earlier than the current date/time. The state of a task being “overdue” is a derived value.
-
Similarly, the amount of “overdueness” is also a derived value that you can always know. (And that amount of time can be visualized as the Task's due date - Current date/time:formatted as... (some interval)
. )
-
Note: The measure of a task’s overdueness (due date - current time) cannot be used to determine if a task is overdue. This is because that measure is not a number, it is a complex data type that Bubble calls a “date interval”. (This may sound strange, but it is true. More about this complex data type below.)
Getting the database involved here just slows things down for no good reason. Don’t do that.
Secondly: Even if you did have a reason to store this value (of “overdueness”), why would you store it as text? It’s just not very helpful.
[EDIT:
OP confirms storing this value as a number. And, indeed, :format as (interval) returns a number (not a text)… but I swear I’ve seen it return strings at times… hmmm…]
Now: How do we achieve what you want properly? And what about note #3 above (date intervals… what are they)?
Let’s tackle that backward: First, the **date interval**
data type is somewhat strange. It’s not in fact intended to be stored in the database, even though that is a thing you can do. It is a data type intended to help us display amounts of time expressed in various time units. It’s a time range formatting thing, if you will.
It’s something that you use in a text field, not something that you are supposed to store. (This is not obvious and you can be forgiven for not knowing this as this is not well documented and this property is unique amongst the various Bubble data types.)
What we do store in our database is dates
(or things like date ranges
) and, from any two dates, when we display them, we can format them as a duration between the two dates (by way of the “date interval” data type).
I can share more about how you actually use this in your use case later…