Skip to content

Releases: brick/date-time

0.7.0

23 Jun 14:35
Compare
Choose a tag to compare

πŸ’₯ Breaking changes

  • DayOfWeek:
    • deprecated method of() has been removed, use DayOfWeek::from() instead
    • the following deprecated methods have been removed, 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
    • deprecated method getValue() has been removed, use $dayOfWeek->value instead
    • deprecated method is() has been removed, compare values with $dayOfWeek or $dayOfWeek->value instead
    • deprecated method isEqualTo() has been removed, use strict equality === between DayOfWeek instances instead.
  • DefaultClock:
    • deprecated method travel() has been removed, use travelTo() instead
  • LocalDate:
    • deprecated method getDay() has been removed, use getDayOfMonth() instead
    • getMonth() now returns a Month enum; use getMonthValue() if you want the month number
  • LocalDateTime:
    • deprecated method getDay() has been removed, use getDayOfMonth() instead
    • getMonth() now returns a Month enum; use getMonthValue() if you want the month number
  • Month:
    • deprecated method of() has been removed, use Month::from() instead
    • deprecated method getAll() has been removed, use Month::cases() instead
    • deprecated method getValue() has been removed, use $month->value instead
    • deprecated method is() has been removed, compare values with $month or $month->value instead
    • deprecated method isEqualTo() has been removed, use strict equality === between Month instances instead
  • MonthDay:
    • deprecated method getDay() has been removed, use getDayOfMonth() instead
    • getMonth() now returns a Month enum; use getMonthValue() if you want the month number
  • YearMonth:
    • getMonth() now returns a Month enum; use getMonthValue() if you want the month number
  • ZonedDateTime:
    • deprecated method getDay() has been removed, use getDayOfMonth() instead
    • getMonth() now returns a Month enum; use getMonthValue() if you want the month number

πŸ”§ Improvements

  • Methods returning int are now type-annotated with int ranges

0.6.5

19 Jun 21:35
Compare
Choose a tag to compare

✨ New methods

  • LocalDate::previousDayOfWeek()
  • LocalDate::previousOrSameDayOfWeek()
  • LocalDate::nextDayOfWeek()
  • LocalDate::nextOrSameDayOfWeek()

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!