I've run in to what I think is a bug in DatePicker.
I live in the UK, so I currently am on UTC+1 (British Summer Time).
When I set a Date Picker's DateTimeZone property to DateTimeZone.Local, SelectedDate shows the same date, and Text() function converts this to a UTC time 1 hour compared to what it would be in my local time. All correct.
However, when I set its DateTimeZone property to DateTimeZone.UTC, SelectedDate shows a date one day before. Text() duly converts this to a time wrong by 23 hours.
Am I right in thinking this is indeed a bug?
Hello @iltoningui,
Thank you for the reply.
I don't think it is related to the default value: this apparent error occurs whichever date I select (see below for an example on a different day).
As you can see, after selecting 1 July 2021 in dte_2, the datetime value stored in SelectedDate is a whole day off what I would expect it to hold. Instead of 2021-07-01T00:00:00.000Z, it shows 2021-06-30T00:00:00.000Z.
Hi @Spinner,
This behaviour is due to the fact that the selected value is actually datetime and not date.
The default value is TODAY() returns the current datetime 21/07/2021 00:00:00 at midnight if you change the time zone in this conditions it might affect the date.
If you are not using the component to select date not time, you should stick with Local as your time zone.