mitsuhiko/when

Problems with 12am/12pm

Closed this issue · 0 comments

kytta commented

Times such as "12am" or "12pm" don't seem to work correctly now. For example, I want to compare times in Montreal and Berlin.

Behaviour for any time other than 12am/pm — works normally:

$ when "5pm in montreal -> berlin"
time: 17:00:00
date: 2021-12-04
location: Montreal (Canada)
zone: America/Toronto (-0500)

time: 23:00:00
date: 2021-12-04
location: Berlin (Germany)
zone: Europe/Berlin (+0100)

Behaviour for "12pm" — program panics:

$ when "12pm in montreal -> berlin"
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/parser.rs:68:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Behaviour for "12am" — program treats it as 12:00 (which AFAIK is 12pm):

$ when "12am in montreal -> berlin"
time: 12:00:00
date: 2021-12-04
location: Montreal (Canada)
zone: America/Toronto (-0500)

time: 18:00:00
date: 2021-12-04
location: Berlin (Germany)
zone: Europe/Berlin (+0100)