time-rs / time

The most used Rust library for date and time handling.
https://time-rs.github.io
Apache License 2.0
1.06k stars 261 forks source link

Add support for only hours in time format with tests #604

Closed GunnarMorrigan closed 12 months ago

GunnarMorrigan commented 12 months ago

Per issue #603 add support for just hours in the time format. This allows leaving out the minutes when parsing a time or datetime object.

If it is necessary to add more tests for specific cases or if the enhancement needs to be implemented through a different method than this simple change, please let me know.

The time macro was not adjusted as I think it does not makes sense to make time!(12) convert to 12:00 instead of 00:12. The user can simply write out the desired time.

codecov[bot] commented 12 months ago

Codecov Report

Merging #604 (1d1c4f8) into main (bd678cb) will decrease coverage by 0.1%. Report is 1 commits behind head on main. The diff coverage is 97.1%.

@@           Coverage Diff           @@
##            main    #604     +/-   ##
=======================================
- Coverage   95.8%   95.7%   -0.1%     
=======================================
  Files         79      79             
  Lines       8932    8973     +41     
=======================================
+ Hits        8557    8589     +32     
- Misses       375     384      +9     
Files Changed Coverage Δ
time/src/parsing/parsed.rs 94.3% <97.1%> (-1.4%) :arrow_down:
time/src/parsing/parsable.rs 98.6% <100.0%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

GunnarMorrigan commented 12 months ago

I will need to check and possibly update the documentation. Will add this

jhpratt commented 12 months ago

Diff looks good. There's one thing I thought of while looking at it, but I don't want to put it on you. Merging as-is :slightly_smiling_face: