Skip to content

Upgrading time 0.2 to 0.3

Breaking0.2.27 → 0.3.55Breaking53Security1Platform1New88Changed24Fixed6Other2

BreakingUpgrade verdict

53 breaking changes and a platform requirement change and a security fix.

  • Renames OffsetDatetime::timestamp to OffsetDateTime::unix_timestamp.
  • Renames OffsetDatetime::timestamp_nanos to OffsetDateTime::unix_timestamp_nanos.
  • Renames Date::try_from_ymd to Date::from_calendar_date.
  • Renames Date::try_from_yo to Date::from_ordinal_date.
Top 5 of 55 that need code or config changes

Requires Rust 1.88.0 from 0.3.46 (none stated before).

Breaking53
Renames OffsetDatetime::timestamp to OffsetDateTime::unix_timestamp.
OffsetDatetime::timestampOffsetDateTime::unix_timestamp
Renames OffsetDatetime::timestamp_nanos to OffsetDateTime::unix_timestamp_nanos.
OffsetDatetime::timestamp_nanosOffsetDateTime::unix_timestamp_nanos
Renames Date::try_from_ymd to Date::from_calendar_date.
Date::try_from_ymdDate::from_calendar_date
Renames Date::try_from_yo to Date::from_ordinal_date.
Date::try_from_yoDate::from_ordinal_date
Renames Date::try_from_iso_ywd to Date::from_iso_week_date.
Date::try_from_iso_ywdDate::from_iso_week_date
Renames Date::as_ymd to Date::to_calendar_date.
Date::as_ymdDate::to_calendar_date
Renames Date::as_yo to Date::to_ordinal_date.
Date::as_yoDate::to_ordinal_date
Renames Date::try_with_hms to Date::with_hms.
Date::try_with_hmsDate::with_hms
Renames Date::try_with_hms_milli to Date::with_hms_milli.
Date::try_with_hms_milliDate::with_hms_milli
Renames Date::try_with_hms_micro to Date::with_hms_micro.
Date::try_with_hms_microDate::with_hms_micro
Renames Date::try_with_hms_nano to Date::with_hms_nano.
Date::try_with_hms_nanoDate::with_hms_nano
Renames Time::try_from_hms to Time::from_hms.
Time::try_from_hmsTime::from_hms
Renames Time::try_from_hms_milli to Time::from_hms_milli.
Time::try_from_hms_milliTime::from_hms_milli
Renames Time::try_from_hms_micro to Time::from_hms_micro.
Time::try_from_hms_microTime::from_hms_micro
Renames Time::try_from_hms_nano to Time::from_hms_nano.
Time::try_from_hms_nanoTime::from_hms_nano
Renames UtcOffset::try_local_offset_at to UtcOffset::local_offset_at.
UtcOffset::try_local_offset_atUtcOffset::local_offset_at
Renames UtcOffset::as_seconds to UtcOffset::whole_seconds.
UtcOffset::as_secondsUtcOffset::whole_seconds
Renames OffsetDateTime::try_now_local to OffsetDateTime::now_local.
OffsetDateTime::try_now_localOffsetDateTime::now_local
Renames Date::week to Date::iso_week.
Date::weekDate::iso_week
Renames PrimitiveDateTime::week to PrimitiveDateTime::iso_week.
PrimitiveDateTime::weekPrimitiveDateTime::iso_week
Renames OffsetDateTime::week to OffsetDateTime::iso_week.
OffsetDateTime::weekOffsetDateTime::iso_week
Renames Date::julian_day to Date::to_julian_day.
Date::julian_dayDate::to_julian_day
Changes the valid year range to ±9999 by default, or ±999,999 with the large-dates feature, which has performance and parsing implications.
large-dates
Removes v0.1 APIs that were previously behind an enabled-by-default feature flag.
PreciseTimeSteadyTimeprecise_time_nsprecise_time_sInstant::toDuration::num_weeksDuration::from_stdDuration::to_std
Removes panicking APIs that were previously behind a non-default feature flag.
Date::from_ymdDate::from_yoDate::from_iso_ywdDate::with_hmsTime::from_hmsTime::from_hms_milliTime::from_hms_microTime::from_hms_nano
Removes APIs that assumed an offset of UTC, previously enabled unconditionally.
Date::todayTime::nowPrimitiveDateTime::nowPrimitiveDateTime::unix_epochPrimitiveDateTime::from_unix_timestampOffsetDateTime::nowUtcOffset::local_offset_atOffsetDateTime::now_local
Removes other APIs deprecated during 0.2, previously enabled unconditionally.
Duration::signPrimitiveDateTime::using_offsetSign
Removes re-exports of APIs moved during the course of 0.2.
days_in_yearis_leap_yearvalidate_format_stringweeks_in_yearComponentRangeErrorConversionRangeErrorIndeterminateOffsetErrorParseError
Removes lazy formatting methods from Time, Date, UtcOffset, PrimitiveDateTime and OffsetDateTime.
Time::lazy_formatDate::lazy_formatUtcOffset::lazy_formatPrimitiveDateTime::lazy_formatOffsetDateTime::lazy_format
Removes support for stdweb, as the crate is unmaintained.
stdweb
Removes the prelude module in its entirety.
prelude
Removes Date::iso_year_week in favor of Date::to_iso_week_date.
Date::iso_year_weekDate::to_iso_week_date
Removes PrimitiveDateTime::iso_year_week.
PrimitiveDateTime::iso_year_week
Removes OffsetDateTime::iso_year_week.
OffsetDateTime::iso_year_week
Removes UtcOffset::east_hours.
UtcOffset::east_hours
Removes UtcOffset::west_hours.
UtcOffset::west_hours
Removes UtcOffset::hours, east_minutes, west_minutes, minutes, east_seconds, west_seconds, and seconds.
UtcOffset::hoursUtcOffset::east_minutesUtcOffset::west_minutesUtcOffset::minutesUtcOffset::east_secondsUtcOffset::west_secondsUtcOffset::seconds
Removes Date::month_day, PrimitiveDateTime::month_day, and OffsetDateTime::month_day.
Date::month_dayPrimitiveDateTime::month_dayOffsetDateTime::month_day
Removes Weekday::iso_weekday_number, which was identical to Weekday::number_from_monday.
Weekday::iso_weekday_numberWeekday::number_from_monday
Removes the ext::NumericalStdDurationShort extension trait.
ext::NumericalStdDurationShort
Places macros behind the macros feature flag.
macros
Makes all Duration unit values, minimum and maximum associated constants.
Duration
Replaces OffsetDateTime::unix_epoch() with the OffsetDateTime::UNIX_EPOCH constant.
OffsetDateTime::unix_epoch()OffsetDateTime::UNIX_EPOCH
Replaces Time::midnight() with the Time::MIDNIGHT constant.
Time::midnight()Time::MIDNIGHT
Makes Date::from_julian_day return a Result.
Date::from_julian_day
Makes OffsetDateTime::from_unix_timestamp return a Result.
OffsetDateTime::from_unix_timestamp
Makes OffsetDateTime::from_unix_timestamp_nanos return a Result.
OffsetDateTime::from_unix_timestamp_nanos
Makes Date::next_day return an Option.
Date::next_day
Makes Date::previous_day return an Option.
Date::previous_day
Gates UtcOffset::local_offset_at and OffsetDateTime::now_local behind the local-offset feature.
UtcOffset::local_offset_atOffsetDateTime::now_locallocal-offset
Changes Date::to_julian_day to return i32 instead of i64.
Date::to_julian_day
Changes Date::from_julian_day to accept i32 instead of i64.
Date::from_julian_day
Seals extension traits and implements them only for some types.
Security1
Denial of Service via Stack Exhaustion
Platform1
Raises the minimum supported Rust version to 1.48.0, which may be bumped within the 0.3 series.