Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equivalent for moment.utc APIs #73

Open
stof opened this issue Apr 30, 2019 · 6 comments
Open

Equivalent for moment.utc APIs #73

stof opened this issue Apr 30, 2019 · 6 comments

Comments

@stof
Copy link

stof commented Apr 30, 2019

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.

@tracker1
Copy link

tracker1 commented May 1, 2019

This will give you a date as the UTC equivolent, which you can then format to your liking.

new Date(originalDate.toJSON().replace(/Z/,''))

@stof
Copy link
Author

stof commented May 2, 2019

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)

@tracker1
Copy link

tracker1 commented May 6, 2019

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.

@tracker1
Copy link

tracker1 commented May 6, 2019

Also, there are lots of examples of Luxon, which is a successor to MomentJS.

@stof
Copy link
Author

stof commented May 7, 2019

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 😄

In the current state of my knowledge, I do need momentjs to achieve my goal.

@tracker1
Copy link

tracker1 commented May 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants