简体   繁体   English

在没有时区的情况下管理moment.js范围

[英]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 当我将其放入fullcalendar v3中时,它将添加我的语言环境(GMT + 1),它会正确显示在日历中(12:30),但是当我从表单中添加新日期时,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! 当我创建一个moment.range时,它会说由于时间调整时区而重叠(相邻为真)! 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 我正在使用此插件:moment.range来自: https : //github.com/rotaready/moment-range

New event date from bootstrap datetimepicker from: https://eonasdan.github.io/bootstrap-datetimepicker/ 引导日期时间选择器中的新事件日期,来自: 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! 现在,我解决了使用utc time.js对象的utc问题,因此所有重叠部分都按预期工作了!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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