Closed Spirka closed 4 years ago
That's just the thing, the datepicker does not add 3 hours, it works exclusively with UTC. It's JavaScript that adds or substracts time based on your timezone. The machine you're running this on (or the browser) must be set to GMT+0300, +3 hours. However, it's important to note that the Date Object still has the correct time, JS only displays it differently with console.log and other operations. You can study the subject further online and see what you want to do with the date and how to format it. I'd recommend mozilla for a comprehensive look at whatever subject you're dealing with or stackoverflow for specific questions.
Thank you for answer. Can I use the Moment library insted of Date? Or String with UTC format?
Well, you may not need moment.js. Regardless, this datepicker doesn't use any third party libraries, it gives you a Date (the exact selected date in UTC), which you can manipulate as required using your own choice of third party library; you just have to set it back as a Date object if you change it elsewhere.
Thank you for explanations.
Why does the datepicker add 3 hours? And how to make sure not to add?