Hey guys, I was using date picker component for one of my project. I noticed that whenever I select a date it selects the date one day before the selected date. I can easily solve it but I was wondering if its a bug. see the attached video
2023-10-19 12-35-09.mkv (488.1 KB)
Hi habibftw,
The date picker is functioning as expected. What you see in App Variables is the ISO-8601 representation of the time and date. When it is databound to a UI component, Create will automatically convert it to the correct value based on your time zone in App Variables.
Here’s an example from our documentation on ISO-8601 and UTC time:
You have a datetime property Order.Delivery Date
. If you set Delivery Date to 14:00 on February 8th when using your app (from a computer in the time zone Europe/Oslo), this is stored as 2020-02-08T13:00:00.000Z
in the database since Europe/Oslo is UTC+1 at winter time.
If you instead set Delivery Date to 14:00 on June 8th, this will be stored as 2020-06-08T12:00:00.000Z
since at that point in time, Europe/Oslo is UTC+2 due to daylight saving time.
In both cases, if you display Order.Delivery Date
using a Text component and data bind the Value to Order.Delivery Date.Hour
, it will display “14:00”. As described above, this is because apps interpret datetime values stored in the database in the context of the app’s current time zone, as stored in the App Variable App Time Zone.
Since the date picker selects the day at midnight, it is stored as the selected day minus 2 hours (accounting for summer time in Norway). This is why you observe that the time and date are stored as yesterday.
You can read more about date and time in our documentation here
Hope this helps