0.9.0 - 2026-01-03
π₯ Breaking changes
- Minimum PHP version is now 8.2
- The following classes are now
final:YearMonthRangeZonedDateTimeParser\DateTimeParseException
0.8.1 - 2025-11-11
β¨ Compatibility improvements
- The following parser and parse methods now accept hours only in timezone offsets, such as
+01equivalent to+01:00(#123 by @antonkomarev):IsoParsers:timeZoneOffset()TimeZoneOffset::parse()ZonedDateTime::parse()
0.8.0 - 2025-11-11
π₯ Breaking changes
Duration::toISOString()and__toString()now output negative durations as-P...(#122 by @BastienClement)
Example:-PT2H21Minstead ofPT-2H-21M.
This aligns with ISO 8601-2:2019 and improves compatibility with the JavaScript Temporal API.
0.7.1 - 2025-08-29
π Bug fixes
ZoneDateTimeincorrectly handled DST Transitions with relative time addition (#115)
β¨ New features
LocalDate::getQuarter()andgetQuarterValue()return the quarter of the year (#114 by @pscheit)
0.7.0 - 2024-06-23
π₯ 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::MONDAYDayOfWeek::tuesday()βDayOfWeek::TUESDAYDayOfWeek::wednesday()βDayOfWeek::WEDNESDAYDayOfWeek::thursday()βDayOfWeek::THURSDAYDayOfWeek::friday()βDayOfWeek::FRIDAYDayOfWeek::saturday()βDayOfWeek::SATURDAYDayOfWeek::sunday()βDayOfWeek::SUNDAY
- deprecated method
getValue()has been removed, use$dayOfWeek->valueinstead - deprecated method
is()has been removed, compare values with$dayOfWeekor$dayOfWeek->valueinstead - deprecated method
isEqualTo()has been removed, use strict equality===betweenDayOfWeekinstances 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 aMonthenum; usegetMonthValue()if you want the month number
- deprecated method
LocalDateTime:- deprecated method
getDay()has been removed, usegetDayOfMonth()instead getMonth()now returns aMonthenum; 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->valueinstead - deprecated method
is()has been removed, compare values with$monthor$month->valueinstead - deprecated method
isEqualTo()has been removed, use strict equality===betweenMonthinstances instead
- deprecated method
MonthDay:- deprecated method
getDay()has been removed, usegetDayOfMonth()instead getMonth()now returns aMonthenum; usegetMonthValue()if you want the month number
- deprecated method
YearMonth:getMonth()now returns aMonthenum; usegetMonthValue()if you want the month number
ZonedDateTime:- deprecated method
getDay()has been removed, usegetDayOfMonth()instead getMonth()now returns aMonthenum; usegetMonthValue()if you want the month number
- deprecated method
π§ Improvements
- Methods returning
intare now type-annotated with int ranges
0.6.5 - 2024-06-19
β¨ New methods
LocalDate::previousDayOfWeek()LocalDate::previousOrSameDayOfWeek()LocalDate::nextDayOfWeek()LocalDate::nextOrSameDayOfWeek()
0.6.4 - 2024-04-25
β¨ New features
DefaultClock::travelBy()travels in time by a duration (#92)
π© Deprecations
DefaultClock::travel()is now deprecated in favour oftravelTo()(#92)
Thanks to @francislavoie!
0.6.3 - 2024-04-02
β¨ New features
Stopwatch::stop()now returns the lap duration (#98)
Thanks to @rodnaph!
0.6.2 - 2024-04-01
β¨ New features
MonthDay::of()andMonthDay::withMonth()now accept aMonthenum as parameter (#106)LocalDate::of()andLocalDate::withMonth()now accept aMonthenum as parameter (#106)LocalDateTime::of()andLocalDateTime::withMonth()now accept aMonthenum as parameter (#106)ZonedDateTime::withMonth()now accepts aMonthenum as parameter (#106)
β¨ Undeprecations
- Passing an
inttoYear::atMonth()is un-deprecated, and now valid again (#103) - Passing an
inttoYearMonth::of()andYearMonth::withMonth()is un-deprecated, and now valid again (#103) - Passing an
inttoYearWeek::atDay()is un-deprecated, and now valid again (#103)
Thanks to @gnutix!
0.6.1 - 2024-03-26
β¨ New features
Year::atMonth()now accepts aMonthenum as parameter (#95)YearMonth::of()andYearMonth::withMonth()now accept aMonthenum as parameter (#96)
π§ Improvements
- Narrower Psalm types for
compareTo(),__toString(),toISOString(),jsonSerialize()methods (#97)
π© Deprecations
- Passing an
inttoYear::atMonth()is now deprecated, pass aMonthenum instead (#95) - Passing an
inttoYearMonth::of()andYearMonth::withMonth()is now deprecated, pass aMonthenum instead (#96)
Thanks to @gnutix!
0.6.0 - 2023-12-05
π₯ Breaking changes
- Minimum PHP version is now 8.1
DayOfWeek:DayOfWeekis now anenum: constantsMONDAY,TUESDAY, etc. are nowDayOfWeekinstances, not integers- the
__toString()method is removed, usetoString()instead (enums disallow magic methods) - the
all()method does not acceptnullanymore, and defaults toDayOfWeek::MONDAY
Month:Monthis now anenum: constantsJANUARY,FEBRUARY, etc. are nowMonthinstances, 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::MONDAYDayOfWeek::tuesday()βDayOfWeek::TUESDAYDayOfWeek::wednesday()βDayOfWeek::WEDNESDAYDayOfWeek::thursday()βDayOfWeek::THURSDAYDayOfWeek::friday()βDayOfWeek::FRIDAYDayOfWeek::saturday()βDayOfWeek::SATURDAYDayOfWeek::sunday()βDayOfWeek::SUNDAY
- the
getValue()method is deprecated, use$dayOfWeek->valueinstead - the
is()method is deprecated, compare values with$dayOfWeek->valueinstead - the
isEqualTo()method is deprecated, use strict equality===betweenDayOfWeekinstances instead.
- the
LocalDate:getDay()is deprecated, usegetDayOfMonth()insteadgetMonth()is deprecated, usegetMonthValue()instead (getMonth()will be repurposed to return aMonthinstance in a future release)
LocalDateTime:getDay()is deprecated, usegetDayOfMonth()insteadgetMonth()is deprecated, usegetMonthValue()instead (getMonth()will be repurposed to return aMonthinstance 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->valueinstead - the
is()method is deprecated, compare values with$month->valueinstead - the
isEqualTo()method is deprecated, use strict equality===betweenMonthinstances instead
- the
MonthDay:getDay()is deprecated, usegetDayOfMonth()insteadgetMonth()is deprecated, usegetMonthValue()instead (getMonth()will be repurposed to return aMonthinstance in a future release)
YearMonth:getMonth()is deprecated, usegetMonthValue()instead (getMonth()will be repurposed to return aMonthinstance in a future release)
YearWeek:- the
atDay()method now accepts aDayOfWeekinstance, passing an integer is deprecated
- the
ZonedDateTime:getDay()is deprecated, usegetDayOfMonth()insteadgetMonth()is deprecated, usegetMonthValue()instead (getMonth()will be repurposed to return aMonthinstance in a future release)
0.5.5 - 2023-10-20
π 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 - 2023-10-16
π 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)DurationInstantIntervalLocalDateLocalDateRangeLocalDateTimeLocalTimeMonthDayPeriodYearYearMonthYearMonthRangeYearWeekZonedDateTime
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 - 2023-09-27
β¨ New methods
Thanks to @solodkiy!
0.5.2 - 2023-09-17
β‘οΈ 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 - 2023-08-01
β¨ New methods
0.5.0 - 2023-06-25
π₯ Breaking changes
-
Deprecated
Intervalconstructor is nowprivate; please useInterval::of()instead -
The following deprecated methods have been removed, please use the new names:
Class Name Old Method Name New Method Name LocalDatefromDateTime()fromNativeDateTime()LocalDatetoDateTime()toNativeDateTime()LocalDatetoDateTimeImmutable()toNativeDateTimeImmutable()LocalDateRangetoDatePeriod()toNativeDatePeriod()LocalDateTimefromDateTime()fromNativeDateTime()LocalDateTimetoDateTime()toNativeDateTime()LocalDateTimetoDateTimeImmutable()toNativeDateTimeImmutable()LocalTimefromDateTime()fromNativeDateTime()LocalTimetoDateTime()toNativeDateTime()LocalTimetoDateTimeImmutable()toNativeDateTimeImmutable()PeriodfromDateInterval()fromNativeDateInterval()PeriodtoDateInterval()toNativeDateInterval()TimeZonefromDateTimeZone()fromNativeDateTimeZone()TimeZonetoDateTimeZone()toNativeDateTimeZone()ZonedDateTimefromDateTime()fromNativeDateTime()ZonedDateTimetoDateTime()toNativeDateTime()ZonedDateTimetoDateTimeImmutable()toNativeDateTimeImmutable()
0.4.3 - 2023-06-20
π§ Improvements
TimeZoneOffset::parse()return type has been narrowed toTimeZoneOffset- Support for seconds in
TimeZoneOffsethas been added back (#60) (@jiripudil)
π Bug fixes
- Old date/times could fail to be parsed by
ZonedDateTimedue to sub-minute timezone offsets (#44)
0.4.2 - 2023-05-19
β¨ New methods
Duration::isGreaterThanOrEqualTo()(#50)Duration::isLessThanOrEqualTo()(#50)Interval::of()(#64)Interval::contains()(#64)Interval::intersectsWith()(#64)Interval::getIntersectionWith()(#64)Interval::isEqualTo()(#64)
π© Deprecations
Intervalconstructor is deprecated in favour ofInterval::of()(#64)
0.4.1 - 2022-06-18
β¨ New methods
LocalDateRange::toPeriod()(#51)Year::toLocalDateRange()(#46)YearMonth::toLocalDateRange()(#46)YearMonthRange::toLocalDateRange()(#46)YearWeek::toLocalDateRange()(#46)
π© Deprecations
The following methods have been deprecated in favour of new names (#47):
Period::fromDateInterval()βfromNativeDateInterval()Period::toDateInterval()βtoNativeDateInterval()TimeZone::fromDateTimeZone()βfromNativeDateTimeZone()TimeZone::toDateTimeZone()βtoNativeDateTimeZone()LocalTime::fromDateTime()βfromNativeDateTime()LocalTime::toDateTime()βtoNativeDateTime()LocalTime::toDateTimeImmutable()βtoNativeDateTimeImmutable()LocalDateRange::toDatePeriod()βtoNativeDatePeriod()LocalDate::fromDateTime()βfromNativeDateTime()LocalDate::toDateTime()βtoNativeDateTime()LocalDate::toDateTimeImmutable()βtoNativeDateTimeImmutable()ZonedDateTime::fromDateTime()βfromNativeDateTime()ZonedDateTime::toDateTime()βtoNativeDateTime()ZonedDateTime::toDateTimeImmutable()βtoNativeDateTimeImmutable()LocalDateTime::fromDateTime()βfromNativeDateTime()LocalDateTime::toDateTime()βtoNativeDateTime()LocalDateTime::toDateTimeImmutable()βtoNativeDateTimeImmutable()
0.4.0 - 2021-12-23
π₯ Breaking changes
- Minimum PHP version is now 7.4
TimeZoneOffsetdoes not allow seconds anymore (#35):TimeZoneOffset::of()'s$secondsparameter is removedTimeZoneOffset::ofTotalSeconds()now throws if the number of seconds is not a multiple of60IsoParsers::timeZoneOffset()does not allow seconds in timezone offset anymore; this affects not onlyTimeZoneOffset:parse()but alsoZonedDateTime::parse()
π§ Fix
- Fixed return type of
TimeZoneRegion::parse()(#38) Thanks to @adrianguenter
β¨ New methods
Period::fromDateInterval()converts a nativeDateIntervalobject toPeriod
0.3.2 - 2021-06-30
β¨ New methods
DayOfWeek::isWeekday()DayOfWeek::isWeekend()LocalDate::plusWeekdays()LocalDate::minusWeekDays()
0.3.1 - 2021-06-29
β¨ New methods
LocalDateRange::withStart()LocalDateRange::withEnd()
0.3.0 - 2021-04-24
π₯ Breaking changes
- The following methods now have return types:
Brick\DateTime\DayOfWeek::monday()throughsunday()Brick\DateTime\DayOfWeek::__toString()Brick\DateTime\Month::__toString()
0.2.3 - 2021-02-26
β¨ New method
LocalDateRange::toDatePeriod()(#31) Thanks to @morrislaptop
π§ Fix
- Added missing
ext-jsonrequirement incomposer.json
0.2.2 - 2020-07-30
π Bug fix
LocalDateTime::plusDuration() and LocalDateTime::minusDuration() could return the wrong day. (#25)
Thanks @JodyLognoul!
0.2.1 - 2020-04-06
β¨ New methods
LocalDateRange::intersectsWith()LocalDateRange::getIntersectionWith()
Thanks @solodkiy!
0.2.0 - 2020-01-08
π₯ Breaking changes
- most of the project classes are now
final(#8) - the following deprecated methods have been removed:
LocalDateRange::getStartDate()- usegetStart()instead (#13)LocalDateRange::getEndDate()- usegetEnd()instead (#13)Duration::ofMilliseconds()- useofMillis()instead
0.1.16 - 2020-01-08
β¨ New methods
LocalDateRange::getStart()- deprecatesgetStartDate()LocalDateRange::getEnd()- deprecatesgetEndDate()
π© Deprecations
LocalDateRange::getStartDate()is now deprecated and will be removed in0.2.0.LocalDateRange::getEndDate()is now deprecated and will be removed in0.2.0.
This makes LocalDateRange consistent with YearMonthRange.
0.1.15 - 2020-01-07
π Improvement
The following classes now implement JsonSerializable (#19):
DayOfWeekDurationInstantIntervalLocalDateLocalDateRangeLocalDateTimeLocalTimeMonthMonthDayPeriodYearYearMonthYearMonthRangeYearWeekZonedDateTime
Thanks to @kagmole!
0.1.14 - 2019-09-17
β¨ New methods
Duration::toDays()Duration::toDaysPart()Duration::toHours()Duration::toHoursPart()Duration::toMinutes()Duration::toMinutesPart()Duration::toSeconds()Duration::toSecondsPart()Duration::toMillis()Duration::toMillisPart()Duration::toNanos()Duration::toNanosPart()Duration::ofNanos()
See #15 for more information.
π© Deprecations
Duration::ofMilliseconds()is nowofMillis();ofMilliseconds()is now deprecated and will be removed in0.2.0.
0.1.13 - 2019-04-17
New methods
LocalDateTime::isFuture()LocalDateTime::isPast()
These methods return whether a local date-time is in the future or in the past, in a given time-zone.
0.1.12 - 2019-04-15
New methods
Instant::withEpochSecond()returns a copy of theInstantwith the epoch second alteredInstant::withNano()returns a copy of theInstantwith the nano-of-second altered
0.1.11 - 2019-03-08
New class: YearMonthRange.
0.1.10 - 2019-03-08
LocalDateRange::getIterator() is now type-hinted as LocalDate[] to allow static code analysis in IDEs.
0.1.9 - 2018-11-14
New method: LocalDate::daysUntil()
This allows to get the number of days between two dates.
0.1.8 - 2018-10-29
New methods to convert objects to native DateTimeImmutable objects:
LocalDate::toDateTimeImmutable()LocalTime::toDateTimeImmutable()LocalDateTime::toDateTimeImmutable()ZonedDateTime::toDateTimeImmutable()
0.1.7 - 2018-10-18
New methods to convert to native DateTime objects:
LocalDate::toDateTime()LocalTime::toDateTime()LocalDateTime::toDateTime()
This makes these methods in line with their fromDateTime() counterparts.
Note: even though these classes represent partial date-time concepts, PHP merges all these concepts into a single DateTime class, so it is relevant to be able to easily export them as native PHP date-times, with sensible defaults.
0.1.6 - 2018-10-18
New method:
ZonedDateTime::toDateTime() : converts the ZonedDateTime to a native DateTime object.
0.1.5 - 2018-10-13
New factory method:
Duration::ofMilliseconds()
0.1.4 - 2018-03-14
New methods available to create objects from native DateTime or DateTimeImmutable objects:
LocalDate::fromDateTime()LocalTime::fromDateTime()LocalDateTime::fromDateTime()ZonedDateTime::fromDateTime()
0.1.3 - 2018-02-06
This release adds support for YearWeek.
0.1.2 - 2017-10-04
Bug fix:
Duration::multipliedBy()could return an invalid Duration with negative nanos
New methods:
Instant::toDecimal()returns a decimal timestamp such as123456789.123456FixedClock::move()allows to move the clock by a number of seconds and/or nanos
New clock implementation:
ScaleClockmakes the time move at a given pace
New feature:
- Methods such as
now()now use the clock returned byDefaultClock. By default, this clock is stillSystemClock, but it can now be overridden in tests. DefaultClock offers thefreeze(),travel()andscale()methods inspired by timecop.
0.1.1 - 2017-10-04
ZonedDateTime::isPast() and isFuture() now accept an optional Clock parameter.
0.1.0 - 2017-10-04
First beta release.