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
Remove timezone from a moment.js object #2788
Comments
As moment will format original date to be a local timezone date. i.e. 2017-08-02 10:00:00+02:00 will be formatted to be 2017-08-02 16:00:00+08:00 if the machine system using +08:00 timezone. I wrote a function to format original date ignoring timezone:
Source code: https://github.com/tangshuang/moment-format Use this function to format date ignore moment default format logic. 2017-08-02 10:00:00+02:00 will be formatted like 2017/08/02 10:00:00+02:00. |
|
@Pawelh133 it doesn't. moment('2022-08-02T11:30:00-09:00').utc(true) will give |
I'm using datetimepicker.js and its
date
function returns a moment.js object. It does so with the local UTC offset in it and my original date has a different offset.My original date:
What I display on the date time picker (
DD-MM HH:mm
):What I get:
What I want:
Note how I removed the +01 offset at the end.
How can I do this applying it for any local UTC ? This is, without having to manually remove the 01 (as it can be a any other local offset depending on the user location).
This is what I have so far to get the date, but I don't know how to remove the offset by keeping the same time.
The text was updated successfully, but these errors were encountered: