12 hour clock selection, fix #119

This commit is contained in:
les 2021-07-15 23:35:16 +02:00
parent e2227010f5
commit e18b56447a
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -98,11 +98,11 @@ export default {
},
hourList () {
const hourList = []
const pad = '00'
const leftPad = h => ('00' + h).slice(-2)
for (let h = 0; h < 24; h++) {
const paddedHour = (pad + h).slice(-2)
hourList.push({ text: paddedHour + ':00 ' + (h <= 12 ? 'AM' : 'PM'), value: paddedHour + ':00' })
hourList.push({ text: paddedHour + ':30 ' + (h <= 12 ? 'AM' : 'PM'), value: paddedHour + ':30' })
const textHour = leftPad(h < 13 ? h : h - 12)
hourList.push({ text: textHour + ':00 ' + (h <= 12 ? 'AM' : 'PM'), value: leftPad(h) + ':00' })
hourList.push({ text: textHour + ':30 ' + (h <= 12 ? 'AM' : 'PM'), value: leftPad(h) + ':30' })
}
return hourList