Open stof opened 5 years ago
This will give you a date as the UTC equivolent, which you can then format to your liking.
new Date(originalDate.toJSON().replace(/Z/,''))
Well, the thing is, a startOfDay
working in UTC is not meant to give the same result than a startOfDay
running in local timezone (as one would put it at midnight UTC and the other one at midnight local time).
That kind of things is working fine with moment.utc
APIs (and you can still get an ISO string out of it after all the manipulations)
Well, this being an open project on Github, you're more than welcome to contribute a more thorough pull request, since you understand the underlying library's behavior better.
Also, there are lots of examples of Luxon, which is a successor to MomentJS.
well, the thing is, I don't know what the equivalent of these moment.js APIs are for each of the alternative libraries (which I don't know well). I was hoping that your website could give me the answer :smile:
In the current state of my knowledge, I do need momentjs to achieve my goal.
I'd suggest at least looking at Luxon and see if it does what you need. It's by the moment js developers, just newer, safer, smaller and cleaner.
I don't work on this library, just one of many repositories I watch
momentjs supports using it either in the local timezone or in the UTC timezone. But this repo only gives alternatives for the local timezone case. It would be great to have alternatives for the UTC case too.