bradymholt / cRonstrue

JavaScript library that translates Cron expressions into human readable descriptions
http://bradymholt.github.io/cRonstrue/
MIT License
1.28k stars 168 forks source link

Incorrect leading zero in 12-hour time #254

Closed JasonWeill closed 7 months ago

JasonWeill commented 1 year ago

Thanks for all the great work on cRonstrue!

I noticed that when a time in 24-hour format is converted to 12-hour format, it still has a leading zero: 16:51 or 51 16 * * * becomes 04:51 PM. The leading zero for hours is used in 24-hour time (e.g., 04:51 for 4:51 AM) but not in 12-hour time. I would expect 16:51 to be translated as 4:51 PM.

bradymholt commented 1 year ago

Hi @jweill-aws - I've seen requests for both formats and I think ISO 8601 (at least) calls for leading zeros. Regardless, adding an option for this could be useful.

Related: https://github.com/bradymholt/cRonstrue/issues/217