Releases: brick/date-time
Releases · brick/date-time
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!