B
B
bugagashnik2018-03-20 14:01:27
JavaScript
bugagashnik, 2018-03-20 14:01:27

How to remove the timezone from the date and set the end of the day?

I am using React Datepicker library . I get the date, but it comes with a +6 time zone: Wed Mar 28 2018 06:00:00 GMT+0600 (+06) - March 28 selection example.
The question is the following: I need to remove the timezone and set the time to the end of the day. I tried a lot, in the end, the maximum I got was exactly 17.59 on this date (-6 hours from 23.59).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sgrogov, 2018-03-20
@bugagashnik

If you understand correctly, you want to get:
For this, as mentioned above, use moment.js like this: Read more in the official documentation . You should be interested in the second parameter. Just in case, here are some examples:

moment('2018.01.01 12:00:00+06:00').utcOffset(0, false).format(); // '2018.01.01 06:00:00+00:00'
moment('2018.01.01 12:00:00+06:00').utcOffset(0, true).format(); // '2018.01.01 12:00:00+00:00'

A
Alexey Ukolov, 2018-03-20
@alexey-m-ukolov

she comes with a time zone
She doesn't go anywhere. It uses the moment library, check its documentation .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question