How to process time data in the form of |

to make a course scheduling system, pass the selected course time period to the backend, and the structural data of the backend needs such
localhost:10090/paiban/save?teacherId=1&paiban=2018-08-08 | 08:00-09:00 | 10:00-12:00 | 13:00-19 Glaze 00002018-08-09 | 08:00-09:00 | 10:00-12:00 | 13:00-19:00
because you have to queue for many days, but also pass the selected time period of each day

.

the key is that there is no train of thought. Please give me some advice


The idea of

is that you first need to generate structured data, and then switch to string when you need it.

let demo = [{
        date: '2018-08-08',
        ranges: [
            ['08:00', '09:00'],
            ['12:00', '13:00']
        ]
    },
    {
        date: '2018-08-09',
        ranges: [
            ['08:00', '09:00'],
            ['12:00', '13:00']
        ]
    }
]

 demo.map(d => {
    return d.date + '|' + d.ranges.map(r => r.join('-')).join('|')
}).join(',')
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be7f78-31041.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be7f78-31041.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?