Is DST ShiftedFrom 2.3.0, Deprecated 2.14.0
moment('2013-03-10 2:30', 'YYYY-MM-DD HH:mm').isDSTShifted()
Note: As of version 2.14.0 this function is deprecated. It doesn't givethe right answer after modifying the moment object. For more information referto moment/3160
Another important piece of validation is to know if the date has been moved by a DST. For example, in most of the United States:
moment('2013-03-10 2:30', 'YYYY-MM-DD HH:mm').format(); //=> '2013-03-10T01:30:00-05:00'
This is because daylight saving time shifts the time from 2:00 to 3:00, so 2:30 isn't a real time. The resulting time is browser-dependent, either adjusting the time forward or backwards. Use moment#isDSTShifted
to test for this condition.
Note: before 2.3.0, Moment objects in this condition always returned false
for moment#isValid
; they now return true
.
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .