uutils / findutils

Rust implementation of findutils
MIT License
314 stars 38 forks source link

find/time: calculate midnight with local time zone #467

Closed NaviHX closed 1 month ago

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 66.59%. Comparing base (dce8b2d) to head (c1db23c). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #467 +/- ## ========================================== + Coverage 66.50% 66.59% +0.09% ========================================== Files 36 36 Lines 4436 4439 +3 Branches 991 978 -13 ========================================== + Hits 2950 2956 +6 - Misses 1062 1064 +2 + Partials 424 419 -5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cakebaker commented 1 month ago

It looks like you are using some deprecated functions:

error: use of deprecated method `chrono::DateTime::<Tz>::date`: Use `date_naive()` instead
  --> src/find/matchers/time.rs:28:41
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |                                         ^^^^
   |
   = note: `-D deprecated` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(deprecated)]`

error: use of deprecated method `chrono::Date::<Tz>::and_hms`: Use and_hms_opt() instead
  --> src/find/matchers/time.rs:28:48
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |
sylvestre commented 1 month ago
NaviHX commented 1 month ago

It looks like you are using some deprecated functions:

error: use of deprecated method `chrono::DateTime::<Tz>::date`: Use `date_naive()` instead
  --> src/find/matchers/time.rs:28:41
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |                                         ^^^^
   |
   = note: `-D deprecated` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(deprecated)]`

error: use of deprecated method `chrono::Date::<Tz>::and_hms`: Use and_hms_opt() instead
  --> src/find/matchers/time.rs:28:48
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |

I removed the use of DateTime::date and Date::and_hms .

  • it will need tests to make sure we don't regress :)

I added a test find::matchers::time::tests::get_local_midnight .