Noon shows up as "0PM", but should be "12PM"
gkd720 opened this issue · 2 comments
gkd720 commented
I'm formatting a DateTime object that shows up in Linux as 'Mon Nov 5 12:00:00 EST 2018'. In my app, I'm formatting it with '[h,am]', and it outputs "0PM", when I would expect '12PM'. In the code, I see writing AM or PM based on: date.hour date.hour < 12 ? 'AM' : 'PM'. Maybe this should be "<="? Or, should the outputting of the hour not be a plain "hour % 12", but if hour%12==0, then add 12? I suspect this would also fix midnight coming out as "0AM". Thanks.
tejainece commented
Will fix it
tejainece commented
Fixed by b69ab59.
Tests can be found here:
date_format/test/date_format_test.dart
Line 30 in b69ab59