-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename TimeZone::timestamp*
to TimeZone::and_timestamp*
#1523
Conversation
492dc14
to
759def9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 0.5.x #1523 +/- ##
==========================================
- Coverage 93.97% 93.95% -0.02%
==========================================
Files 37 37
Lines 16686 16672 -14
==========================================
- Hits 15680 15665 -15
- Misses 1006 1007 +1 ☔ View full report in Codecov by Sentry. |
759def9
to
d5f9a92
Compare
So we may have this Can we do some part of this on main? |
Fine by me. Then we should probably rename the current |
How are the semantics for current |
Currently the |
Other methods that start with And one more that starts with |
I'll collect some info in an issue. |
c048627
to
fa27e5c
Compare
Added commits to rename all methods from #1527 except I am not 100% conviced with the new names for Example code: let pst = FixedOffset::east(8 * 60 * 60)?;
// in_timezone
let dt = NaiveDate::from_ymd(2018, 1, 11)?.at_hms(10, 5, 13)?.in_timezone(pst);
// assume_timezone
let dt = NaiveDate::from_ymd(2018, 1, 11)?.at_hms(10, 5, 13)?.assume_timezone(pst);
// in_utc
let timestamp = NaiveDate::from_ymd(1970, 1, 1)?.at_hms(0, 0, 0).in_utc().timestamp();
// assume_utc
let timestamp = NaiveDate::from_ymd(1970, 1, 1)?.at_hms(0, 0, 0).assume_utc().timestamp(); |
src/datetime/mod.rs
Outdated
/// let dt = NaiveDate::from_ymd(2018, 1, 26) | ||
/// .unwrap() | ||
/// .at_hms_micro(18, 30, 9, 453_829) | ||
/// .unwrap() | ||
/// .and_local_timezone(Utc) | ||
/// .unwrap(); | ||
/// .and_utc(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems weird if a later commit is just going to change it again to in_utc()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This commit is merged on the main branch in #1530. I'll wait until main is merged into the 0.5.x branch again and then rebase this PR.
fa27e5c
to
f80253c
Compare
We have the pattern to use the name
and_
for methods that add information to convert to a more complete type.NaiveDate
hadand_time
andand_hms*
,NaiveDateTime
hasand_local_timezone
.This makes the methods on
TimeZone
consistent.TimeZone::timestamp*
is renamed toTimeZone::and_timestamp*
andTimeZone::with_ymd_and_hms
toTimeZone::and_ymd_and_hms*
.