Skip to content

Releases: brick/date-time

0.6.4

25 Apr 09:55
Compare
Choose a tag to compare

New features

  • DefaultClock::travelBy() travels in time by a duration (#92)

🗑️ Deprecations

  • DefaultClock::travel() is now deprecated in favour of travelTo() (#92)

Thanks to @francislavoie!

0.6.3

02 Apr 21:19
Compare
Choose a tag to compare

New features

  • Stopwatch::stop() now returns the lap duration (#98)

Thanks to @rodnaph!

0.6.2

01 Apr 15:26
Compare
Choose a tag to compare

New features

  • MonthDay::of() and MonthDay::withMonth() now accept a Month enum as parameter (#106)
  • LocalDate::of() and LocalDate::withMonth() now accept a Month enum as parameter (#106)
  • LocalDateTime::of() and LocalDateTime::withMonth() now accept a Month enum as parameter (#106)
  • ZonedDateTime::withMonth() now accepts a Month enum as parameter (#106)

Undeprecations

  • Passing an int to Year::atMonth() is un-deprecated, and now valid again (#103)
  • Passing an int to YearMonth::of() and YearMonth::withMonth() is un-deprecated, and now valid again (#103)
  • Passing an int to YearWeek::atDay() is un-deprecated, and now valid again (#103)

Thanks to @gnutix!

0.6.1

26 Mar 22:31
Compare
Choose a tag to compare

New features

  • Year::atMonth() now accepts a Month enum as parameter (#95)
  • YearMonth::of() and YearMonth::withMonth() now accept a Month enum as parameter (#96)

🔧 Improvements

  • Narrower Psalm types for compareTo(), __toString(), toISOString(), jsonSerialize() methods (#97)

💩 Deprecations

  • Passing an int to Year::atMonth() is now deprecated, pass a Month enum instead (#95)
  • Passing an int to YearMonth::of() and YearMonth::withMonth() is now deprecated, pass a Month enum instead (#96)

Thanks to @gnutix!

0.6.0

05 Dec 21:59
Compare
Choose a tag to compare

💥 Breaking changes

  • Minimum PHP version is now 8.1
  • DayOfWeek:
    • DayOfWeek is now an enum: constants MONDAY, TUESDAY, etc. are now DayOfWeek instances, not integers
    • the __toString() method is removed, use toString() instead (enums disallow magic methods)
    • the all() method does not accept null anymore, and defaults to DayOfWeek::MONDAY
  • Month:
    • Monthis now an enum: constants JANUARY, FEBRUARY, etc. are now Month instances, not integers
    • the __toString() method is removed, use toString() instead (enums disallow magic methods)

💩 Deprecations

  • DayOfWeek:
    • the of() method is deprecated, use DayOfWeek::from() instead
    • the following methods are deprecated, use enum values instead:
      • DayOfWeek::monday()DayOfWeek::MONDAY
      • DayOfWeek::tuesday()DayOfWeek::TUESDAY
      • DayOfWeek::wednesday()DayOfWeek::WEDNESDAY
      • DayOfWeek::thursday()DayOfWeek::THURSDAY
      • DayOfWeek::friday()DayOfWeek::FRIDAY
      • DayOfWeek::saturday()DayOfWeek::SATURDAY
      • DayOfWeek::sunday()DayOfWeek::SUNDAY
    • the getValue() method is deprecated, use $dayOfWeek->value instead
    • the is() method is deprecated, compare values with $dayOfWeek->value instead
    • the isEqualTo() method is deprecated, use strict equality === between DayOfWeek instances instead.
  • LocalDate:
    • getDay() is deprecated, use getDayOfMonth() instead
    • getMonth() is deprecated, use getMonthValue() instead (getMonth() will be repurposed to return a Month instance in a future release)
  • LocalDateTime:
    • getDay() is deprecated, use getDayOfMonth() instead
    • getMonth() is deprecated, use getMonthValue() instead (getMonth() will be repurposed to return a Month instance in a future release)
  • Month:
    • the of() method is deprecated, use Month::from() instead
    • the getAll() method is deprecated, use Month::cases() instead
    • the getValue() method is deprecated, use $month->value instead
    • the is() method is deprecated, compare values with $month->value instead
    • the isEqualTo() method is deprecated, use strict equality === between Month instances instead
  • MonthDay:
    • getDay() is deprecated, use getDayOfMonth() instead
    • getMonth() is deprecated, use getMonthValue() instead (getMonth() will be repurposed to return a Month instance in a future release)
  • YearMonth:
    • getMonth() is deprecated, use getMonthValue() instead (getMonth() will be repurposed to return a Month instance in a future release)
  • YearWeek:
    • the atDay() method now accepts a DayOfWeek instance, passing an integer is deprecated
  • ZonedDateTime:
    • getDay() is deprecated, use getDayOfMonth() instead
    • getMonth() is deprecated, use getMonthValue() instead (getMonth() will be repurposed to return a Month instance in a future release)

0.5.5

20 Oct 17:30
Compare
Choose a tag to compare

🐛 Bug fixes

  • Year::toISOString() / __toString() did not respect ISO 8601; years with less than 4 digits are now left-padded with zeros (#90)

Thanks to @andreaswolf!

0.5.4

16 Oct 21:17
f4d8dfd
Compare
Choose a tag to compare

🐛 Bug fixes

  • YearMonth::__toString() would return an invalid string for years < 1000 (#87)

New methods

  • Year::parse() and Year::from() (#86)
  • YearWeek::parse() and YearWeek::from() (#86)
  • the following classes now have a toISOString() method: (#87)
    • Duration
    • Instant
    • Interval
    • LocalDate
    • LocalDateRange
    • LocalDateTime
    • LocalTime
    • MonthDay
    • Period
    • Year
    • YearMonth
    • YearMonthRange
    • YearWeek
    • ZonedDateTime

The toISOString() methods return the same result as __toString(), but are better suited for the nullsafe operator:

$date?->toISOString();

⚡️ Performance optimizations

  • Most __toString() methods got a small performance boost (#85)

Thanks to @gnutix!

0.5.3

26 Sep 22:11
Compare
Choose a tag to compare

New methods

  • Instant::getIntervalTo() (#81)
  • ZonedDateTime::getIntervalTo() (#81)

Thanks to @solodkiy!

0.5.2

16 Sep 22:40
Compare
Choose a tag to compare

⚡️ Performance optimizations

  • These methods got a small performance boost: Local(Date|Time|DateTime) minOf()/maxOf() (#76)
  • Static objects returned by factory methods are now cached (#77)
  • The special case LocalDate::plusDays(1) is now much faster (#79)

Thanks to @gnutix and @BastienClement!

0.5.1

01 Aug 09:20
Compare
Choose a tag to compare

New methods