So I’m using bubble as a backend/DB for my discord bot, but was wondering if its possible to send back relative time as an api response?
What is relative time?
4 days ago, 1 months ago, etc
If you send it as text, sure. Just send Arbitrary text((Current date-time - Thing's Date:format as days:rounded to 0) days ago)
. If Current date-time - Thing’s date > 7 days change format as days to format as weeks, and if Current date-time - Thing’s date > 28 days change format as days to format as months or whatever.
Thanks, so to format as months, since theres no option, would I just divide the days by 30?
Yep similar to this:
On a similar theme…Is Arbitrary Date/Time dynamic i.e. if I enter ‘last week’, say for a button filter on an RG will it always show last week relative to current date/time? It doesn’t appear to. In the arbitraty field I entered ‘last week’. On my screenshot that Wed 8 Nov doesn’t change with time. Is my expression wrong?
Arbitrary dates must be in standard date/time format. To set a date to last week, set state of element to Current date/time +days -7:rounded down to week
. Today is Wednesday, so this will evaluate to Monday of last week.
Ah brilliant, many thx, understood.
One other thing I’m struggling with, I also want a button filter for ‘This Quarter’ and ‘Last quarter’ with the quarters being set at Jan-Mar, Apr-Jun etc. Any ideas how I can achieve that?
This works only when not in the first quarter:
Still trying to solve how to handle when last quarter is in the previous year. But if you need it now, this will work until January
Okay, I believe this should be good to go for calculating the start date of the last quarter:
Similar logic would be required for the end date.
Trying to copy that but not able to get those parenthesis in…?
Enable parentheses in versions tab of the editor