简体   繁体   中英

Managing moment.js range without timezones

I'm having problem with moment-range due to timezone! I get events from a database that return a string, eg

start:"2019-02-08T12:30:00Z"
end:"2019-02-08T13:30:00Z"

When I put it inside fullcalendar v3 it will add my locale (GMT+1), it is shown correctly inside the calendar (12:30), but when I'm adding a new date from my form, fe

start:08/02/2019 - 14:30
end:08/02/2019 - 17:30

When I create a moment.range it says it overlap (adjacent is true) due to moment adjusting the timezone! How can I manage event creation without worrying about time zones?

EDIT: Yeah sorry for the lack of information.

I'm using this plugin: moment.range from: https://github.com/rotaready/moment-range

New event date from bootstrap datetimepicker from: https://eonasdan.github.io/bootstrap-datetimepicker/

Now I solved my problem working with utc time of moment.js objects so now all overlaps work as expected!

我简单地使用moment.utc()而不是moment()解决了我的问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM