I am having an issue with displaying the correct date in a text component. I am trying to display, with magic text, the Date of a scheduled meeting. For example: I stored the Date “7/21/22” by inputting it into this form:
The same date is being displayed next to “Date:” in the screenshot below:
As you can see, the date has changed to “7/20/22”.
For more proof, I did this same thing by inputting “7/20/22” into the form and the text box displays that value as “7/19/22”. What is clearly happening here is some kind of subtraction by one day.
The only thing I am changing in between storing and displaying this value is the object that the date belongs to. The date gets stored in my “Available Days” Collection, but by the time I display it, it is in the “Meetings” collection. All I am doing is transferring the date from one collection to another, and somehow it is getting subtracted by one.
Hi @dilon_perera , here are two videos describing my problem.
In the first video (above) you can see I am creating a new “Available Day” object via a form. As you can see, the day I am choosing is July 24th, 2022.
In the second video (above), I am now logged in as a different type of User. I click on John’s availability screen and can now see a new day of availability (the one that we just added via the form). I select and confirm a time. However, back on my upcoming meetings list, the meeting is incorrectly displaying as being on July 23rd, NOT July 24th (as it should be).
Every time slot has its own orange confirm button, and every orange confirm button has a Create Meeting action that fills with the data in the image above. Within the Meeting’s fields, the “Meeting Day” field specifically gets filled with the current Available Day’s “Date” field. (Where I am making sure to use MM/DD/YYYY format). The current Available Day’s “Date” field is actually being displayed at the top of each day on this screen, so we know exactly what the correct date should be when it gets stored in the Meeting object in the orange confirm button. However the correct date is not being stored - it always stores the date that is exactly one day before the correct date.
Apart from this simple moving from one object to another, (again - the Current Available Day’s Date field getting stored inside a New Meeting’s Meeting Day field) no other manipulations are happening to either of these fields.
This is why I’m not sure what’s exactly going on here.
This is a date transfer bug, which is related to the way Adalo works with dates. I’ve reproduced it in my test app - same effect.
I think the reason is the following.
To start with, Adalo internally stores DateTimes and Dates as number of days since 1/1/1970. For DateTime, Integer value represents the date, and decimal represent the “fraction of the day”.
E.g. 19196.25 is equal to 6AM, 23rd of July 2022 in GMT+0 time zone. Then, the actual time displayed for a user is adjusted using user’s timezone settings. For someone in New York (GMT-4) this date will be displayed as 2AM same day (though, of course, the value stored doesn’t change).
For Dates, only Integer value is stored in the database (e.g. 19196 for 23rd of July 2022).
I guess in your case the following happens. When you update the date property in the first collection, it is stored correctly (as 19196 for today).
But when you update the date property in the second collection with the date from the first one, here is what might happen:
Adalo takes the date as “date” (e.g. 19196)
then it adjusts it to your timezone (prepares it to display as 8PM 22nd of July)
and when it stores it to the second collection, it does another conversion from Datetime to date (8PM 22nd of July → 22nd of July = 19195).
This bug will exist for the countries with timezones to the west of Greenwich.
What could be done here:
store dates in datetime format (potential issues for the users from very different timezones)
use numeric property to store the date’s value “in between”.
I’m getting this error due to daylight savings lol
If I book an appointment up until March 29th, it saves the correct time that I selected, but if I book it from March 30th to October 25th, it creates the appointment one hour later. Unbelievable.