Hello, I am facing a new issue with DateTimes. I am using ASP.NET Core / Angular 2.
On the server, I've configured the server to use UtcProvider. On the client, I've configured the application for UTC+02:00 (Beirut) timezone.
When a date is sent to the server something like 22/10/2017 00:00:00 it gets stored as 21/10/2017 21:00:00. The point is, I've selected a UTC+02:00 so logically the dates should be stored at 21/10/2017 22:00:00. However, given the Day Light thingy, I assume that was taken into consideration when converting to the user's timezone. Correct?
Now on the server, all dates are usually returned as moment.Moment instances.
The calendar I am using (Primeng Calendar) render the date correctly.
When it is time to display a date as a string, I am using several formats as follows:
<span>{{ poc.dateofBirth | momentFormat:'DD-MM-YYYY' }}</span><br/>
21-10-1980
<span>{{ poc.DateofBirth.format() }}</span><br/>
1980-10-21T23:00:00+02:00
<span>{{ poc.dateofBirth.toDate() }}</span><br/>
Tue Oct 22 1980 00:00:00 GMT+0300 (GTB Daylight Time)
<span>{{ abp.timing.convertToUserTimezone(poc.dateofBirth.toDate()) }}</span>
Mon Oct 21 1980 23:00:00 GMT+0200
Notice how the first renders 21 and not 22. Also the second is related to first and renders accordingly with timezone offset of +02:00. The third renders correctly taking into consideration machine's timezone and not the one configured for the application. The fourth also is behaving as the first 2.
If the server is interpreting the application's timezone (UTC+02:00 Beirut) and taking into consideration the Day Light changes, and storing the data in the DB as 21/10/2017 21:00:00 (current time - 3 hours). Why is the client using moment() not taking into consideration the Day Light changes and hence showing the time to be 23:00:00 instead of 00:00:00 and hence a correct Date.
I really appreciate your assistance.
I've posted before on GitHub: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2606">https://github.com/aspnetboilerplate/as ... ssues/2606</a>
Bottom line, the timezones in the app are:
In the DB: Middle East Standard Time On the client: abp.timing.timeZoneInfo.iana.timeZoneId is Asia/Beirut
MEST could be a range according to this document: <a class="postlink" href="http://www.timetemperature.com/middleeast/middle_east_time_zones.shtml">http://www.timetemperature.com/middleea ... ones.shtml</a>
Thanks
2 Answer(s)
-
0
Hi @bilalhaidar,
I assume this is the same issue with <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2606">https://github.com/aspnetboilerplate/as ... ssues/2606</a>, right ? If so, we can continue on github.
-
0
Sure. Thank you