Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

Why does Angular Material Datepicker not add offset to selected utc date?

I'm using the material date-picker (https://material.angular.io/components/datepicker/overview) with option useUtc: true.

My time zone is GMT+1. So when I select the 27th of January 2021, I expect that the resulting UTC-Date would be '2021-01-26T23:00:00Z' but it actually is '2021-01-27T00:00:00Z'.

Isn't this the wrong behaviour or am I missunderstanding something? How can I get the real UTC-Date? This way it is not possible to query the correctly stored UTC-Dates in the API.

Thanks for your help!

question from:https://stackoverflow.com/questions/65920924/why-does-angular-material-datepicker-not-add-offset-to-selected-utc-date

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...