Skip to content

Conversation

@jasonaowen
Copy link
Contributor

Add a new single-argument function for creating a DateTime from a Unix timestamp, to match from_timestamp_micros, from_timestamp_millis, and from_timestamp_nanos.

Resolves #1716 Suggestion: add DateTime::from_timestamp_secs function

@codecov
Copy link

codecov bot commented Aug 9, 2025

Codecov Report

❌ Patch coverage is 95.91837% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.79%. Comparing base (59d5f46) to head (fd92d74).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/datetime/serde.rs 75.00% 1 Missing ⚠️
src/naive/datetime/serde.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1719      +/-   ##
==========================================
+ Coverage   90.78%   90.79%   +0.01%     
==========================================
  Files          39       39              
  Lines       16231    16254      +23     
==========================================
+ Hits        14735    14758      +23     
  Misses       1496     1496              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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!

@jasonaowen
Copy link
Contributor Author

I slimmed down the tests, refactored the existing code to use from_timestamp_secs and from_timestamp_millis, and rebased onto main. I think this is ready to re-review!

@jasonaowen jasonaowen requested a review from djc August 14, 2025 01:58
@djc
Copy link
Member

djc commented Aug 14, 2025

I slimmed down the tests, refactored the existing code to use from_timestamp_secs and from_timestamp_millis, and rebased onto main. I think this is ready to re-review!

Please squash your commits into a single one.

Add a new single-argument function for creating a `DateTime` from a Unix
timestamp, to match `from_timestamp_micros`, `from_timestamp_millis`,
and `from_timestamp_nanos`.

Refactor existing code and examples to use
`DateTime::from_timestamp_secs` and `DateTime::from_timestamp_millis`
where possible.

Issue chronotope#1716 Suggestion: add DateTime::from_timestamp_secs function
@jasonaowen
Copy link
Contributor Author

Relocated and squashed!

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!

@djc djc merged commit 6aeea3f into chronotope:main Aug 14, 2025
35 checks passed
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.

Suggestion: add DateTime::from_timestamp_secs function

2 participants