Releases: brick/date-time
Releases Β· brick/date-time
0.7.0
π₯ Breaking changes
DayOfWeek
:- deprecated method
of()
has been removed, useDayOfWeek::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===
betweenDayOfWeek
instances instead.
- deprecated method
DefaultClock
:- deprecated method
travel()
has been removed, usetravelTo()
instead
- deprecated method
LocalDate
:- deprecated method
getDay()
has been removed, usegetDayOfMonth()
instead getMonth()
now returns aMonth
enum; usegetMonthValue()
if you want the month number
- deprecated method
LocalDateTime
:- deprecated method
getDay()
has been removed, usegetDayOfMonth()
instead getMonth()
now returns aMonth
enum; usegetMonthValue()
if you want the month number
- deprecated method
Month
:- deprecated method
of()
has been removed, useMonth::from()
instead - deprecated method
getAll()
has been removed, useMonth::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===
betweenMonth
instances instead
- deprecated method
MonthDay
:- deprecated method
getDay()
has been removed, usegetDayOfMonth()
instead getMonth()
now returns aMonth
enum; usegetMonthValue()
if you want the month number
- deprecated method
YearMonth
:getMonth()
now returns aMonth
enum; usegetMonthValue()
if you want the month number
ZonedDateTime
:- deprecated method
getDay()
has been removed, usegetDayOfMonth()
instead getMonth()
now returns aMonth
enum; usegetMonthValue()
if you want the month number
- deprecated method
π§ Improvements
- Methods returning
int
are now type-annotated with int ranges
0.6.5
0.6.4
0.6.3
0.6.2
β¨ New features
MonthDay::of()
andMonthDay::withMonth()
now accept aMonth
enum as parameter (#106)LocalDate::of()
andLocalDate::withMonth()
now accept aMonth
enum as parameter (#106)LocalDateTime::of()
andLocalDateTime::withMonth()
now accept aMonth
enum as parameter (#106)ZonedDateTime::withMonth()
now accepts aMonth
enum as parameter (#106)
β¨ Undeprecations
- Passing an
int
toYear::atMonth()
is un-deprecated, and now valid again (#103) - Passing an
int
toYearMonth::of()
andYearMonth::withMonth()
is un-deprecated, and now valid again (#103) - Passing an
int
toYearWeek::atDay()
is un-deprecated, and now valid again (#103)
Thanks to @gnutix!
0.6.1
β¨ New features
Year::atMonth()
now accepts aMonth
enum as parameter (#95)YearMonth::of()
andYearMonth::withMonth()
now accept aMonth
enum as parameter (#96)
π§ Improvements
- Narrower Psalm types for
compareTo()
,__toString()
,toISOString()
,jsonSerialize()
methods (#97)
π© Deprecations
- Passing an
int
toYear::atMonth()
is now deprecated, pass aMonth
enum instead (#95) - Passing an
int
toYearMonth::of()
andYearMonth::withMonth()
is now deprecated, pass aMonth
enum instead (#96)
Thanks to @gnutix!
0.6.0
π₯ Breaking changes
- Minimum PHP version is now 8.1
DayOfWeek
:DayOfWeek
is now anenum
: constantsMONDAY
,TUESDAY
, etc. are nowDayOfWeek
instances, not integers- the
__toString()
method is removed, usetoString()
instead (enums disallow magic methods) - the
all()
method does not acceptnull
anymore, and defaults toDayOfWeek::MONDAY
Month
:Month
is now anenum
: constantsJANUARY
,FEBRUARY
, etc. are nowMonth
instances, not integers- the
__toString()
method is removed, usetoString()
instead (enums disallow magic methods)
π© Deprecations
DayOfWeek
:- the
of()
method is deprecated, useDayOfWeek::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===
betweenDayOfWeek
instances instead.
- the
LocalDate
:getDay()
is deprecated, usegetDayOfMonth()
insteadgetMonth()
is deprecated, usegetMonthValue()
instead (getMonth()
will be repurposed to return aMonth
instance in a future release)
LocalDateTime
:getDay()
is deprecated, usegetDayOfMonth()
insteadgetMonth()
is deprecated, usegetMonthValue()
instead (getMonth()
will be repurposed to return aMonth
instance in a future release)
Month
:- the
of()
method is deprecated, useMonth::from()
instead - the
getAll()
method is deprecated, useMonth::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===
betweenMonth
instances instead
- the
MonthDay
:getDay()
is deprecated, usegetDayOfMonth()
insteadgetMonth()
is deprecated, usegetMonthValue()
instead (getMonth()
will be repurposed to return aMonth
instance in a future release)
YearMonth
:getMonth()
is deprecated, usegetMonthValue()
instead (getMonth()
will be repurposed to return aMonth
instance in a future release)
YearWeek
:- the
atDay()
method now accepts aDayOfWeek
instance, passing an integer is deprecated
- the
ZonedDateTime
:getDay()
is deprecated, usegetDayOfMonth()
insteadgetMonth()
is deprecated, usegetMonthValue()
instead (getMonth()
will be repurposed to return aMonth
instance in a future release)
0.5.5
0.5.4
π Bug fixes
YearMonth::__toString()
would return an invalid string for years< 1000
(#87)
β¨ New methods
Year::parse()
andYear::from()
(#86)YearWeek::parse()
andYearWeek::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!