Skip to content

Conversation

@AVee
Copy link
Contributor

@AVee AVee commented Feb 5, 2025

When looking into doing #1628 I found this comment:
// should we pass NaiveDateTime all the way through to this fn?

// should we pass NaiveDateTime all the way through to this fn?

It seemed a sensible bit of cleanup to do regardless of other changes, so here's a separate pull request for it.

This replaces passing a timestamp and year to several internal functions with passing a NaiveDateTime, making the function signature slightly clearer. The values originated from in the a NaiveDateTime in first place, so it basically just postpones the conversion.
Prep for #1628

This replaces passing a timestamp and year to several internal functions with
passing a NaiveDateTime, making the function signature slightly clearer. The
values originated from in the a NaiveDateTime in first place, so it basically
just postpones the conversion.
Prep for chronotope#1628
let current_year = local_time.year();
let local_time = local_time.and_utc().timestamp();

// Check if the current year is valid for the following computations
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be impossible to fail the check below since (the current implementation of) NaiveDateTime has a max year of 262142. It could be removed, but perhaps we want to keep it in case NaiveDateTime ever gets changed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked what our test coverage is here? I think it's probably fine to remove the check here, maybe add a comment that we're relying on the invariant from the input NaiveDateTime?

Copy link
Contributor Author

@AVee AVee Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the check. I looks like this code isn't currently covered, but I'm already working on #1628 and tests there should cover this.

@codecov
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 91.03%. Comparing base (7cdca4b) to head (9bede9c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/offset/local/tz_info/rule.rs 16.66% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1658   +/-   ##
=======================================
  Coverage   91.02%   91.03%           
=======================================
  Files          37       37           
  Lines       17366    17361    -5     
=======================================
- Hits        15808    15805    -3     
+ Misses       1558     1556    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

let current_year = local_time.year();
let local_time = local_time.and_utc().timestamp();

// Check if the current year is valid for the following computations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked what our test coverage is here? I think it's probably fine to remove the check here, maybe add a comment that we're relying on the invariant from the input NaiveDateTime?

@djc djc merged commit 15e287b into chronotope:main Feb 18, 2025
34 of 35 checks passed
@djc
Copy link
Member

djc commented Feb 18, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants