diff options
| -rwxr-xr-x | nowopen | 12 | ||||
| -rw-r--r-- | places.peg | 2 |
2 files changed, 10 insertions, 4 deletions
@@ -85,11 +85,15 @@ for i,place in ipairs(places) do end end local function t(time) - local hour = tonumber(time.hour) + local hour24 = tonumber(time.hour) local minute = tonumber(time.minute or 0) - if time.ampm == 'pm' then hour = hour + 12 end - local t = os.time{hour=hour, min=minute, year=today.year, month=today.month, day=today.day} - if t < now then t = t + 24*60*60 end + if hour24 == 12 then + if time.ampm == 'am' then hour24 = hour24 - 12 end + else + if time.ampm == 'pm' then hour24 = hour24 + 12 end + end + local t = os.time{hour=hour24, min=minute, year=today.year, month=today.month, day=today.day} + while t < now do t = t + 24*60*60 end return t end if today_times and today_times.open then @@ -16,6 +16,8 @@ days <- time <- {| {:hour: {[0-9]+} :} (":" {:minute: {[0-9]+} :})? {:ampm: { "am" / "pm"} :} + / ("noon" {:hour: {~''->'12'~} :} {:ampm: {~''->'pm'~} :}) + / ("midnight" {:hour: {~''->'12'~} :} {:ampm: {~''->'am'~} :}) |} tag <- word (" "+ word)* word <- [^%nl%tab (),:#0-9-]+ |
