完整日历未按正确顺序对天的事件进行排序

我正在使用完整日历并将此数组传递给完整日历


[{"id":"11589","slot":"Morning",start: "2019-07-18T06:00:00",end: "2019-07-18T09:00:00"},{"id":"11590","slot":"Afternoon",start: "2019-07-18T00:00:00",end: "2019-07-18T00:00:00"},{"id":"11588","slot":"Evening",start: "2019-07-18T17:00:00",end: "2019-07-18T18:15:00"},{"id":"11587","slot":"Night",start: "2019-07-18T20:15:00",end: "2019-07-18T22:15:00"}]

问题是我只想按这个顺序显示一天的事件,但我想要的是下午先来,然后是早上、晚上和晚上。


输出 :


Afternoon 

Morning 

Evening 

Night 

所需输出:


Morning 

Afternoon

Evening 

Night 


白猪掌柜的
浏览 156回答 1
1回答

德玛西亚99

您的问题在于输入数组中的数据。[{"id":"11589","slot":"Morning",start: "2019-07-18T06:00:00",end: "2019-07-18T09:00:00"},{"id":"11590","slot":"Afternoon",start: "2019-07-18T00:00:00",end: "2019-07-18T00:00:00"},{"id":"11588","slot":"Evening",start: "2019-07-18T17:00:00",end: "2019-07-18T18:15:00"},{"id":"11587","slot":"Night",start: "2019-07-18T20:15:00",end: "2019-07-18T22:15:00"}]那天早上下午的时间戳较低,这就是它首先出现的原因。如果您切换日期,尤其是时间在这里很重要,那么一切正常,请参见下文:[{"id":"11589","slot":"Morning",start: "2019-07-18T00:00:00",end: "2019-07-18T00:00:00"},{"id":"11590","slot":"Afternoon",start: "2019-07-18T06:00:00",end: "2019-07-18T09:00:00"},{"id":"11588","slot":"Evening",start: "2019-07-18T17:00:00",end: "2019-07-18T18:15:00"},{"id":"11587","slot":"Night",start: "2019-07-18T20:15:00",end: "2019-07-18T22:15:00"}]
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript