我正在使用完整日历,并将此数组传递给完整日历
[{"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"}]
问题是我只想按照此顺序显示一天的活动,但我想要的是下午到下午,早上,晚上和amp;夜晚。
输出:
Afternoon
Morning
Evening
Night
所需的输出:
Morning
Afternoon
Evening
Night
您的问题来自输入数组的数据。
[{"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"}]