All notable changes to Period will be documented in this file
5.3.3 - 2025-10-17
- None
- Fix inconsistent behaviour for
isBefore()when comparing periods with other periods or dates #138 thanks @brummbar
- None
- None
5.3.2 - 2024-03-23
- None
- Fix package to avoid PHP8.4 deprecation warnings
- None
- None
5.3.1 - 2023-12-06
- None
- None
- None
5.3.0 - 2023-11-28
Chart\LetterCase::convert
- Handles gracefully new Date exception in PHP8.3
- None
- None
5.2.1 - 2023-02-25
- None
Period::fromRangeshould work in PHP8.1 with DatePeriod limitations.
InitialDatePresenceuse insteadPeriod::fromRange
- None
5.2.0 - 2023-02-18
Period::rangeForwardallows iteration over a set of dates and times, recurring at regular intervals, over the instance forward starting from the instance start.Period::rangeBackwardsAllows iteration over a set of dates and times, recurring at regular intervals, over the instance backwards starting from the instance ending.Period::fromRangereturns a newPeriodinstance from aDatePeriodobject. Only usable in PHP8.2+ installation
- Using PHPUnit 10 instead of PHPUnit 9.
Period::dateRangeForwarduse insteadPeriod::rangeForwardPeriod::dateRangeBackwardsuse insteadPeriod::rangeBackwards
- None
5.1.0 - 2022-06-28
DatePoint::fromFormatto instantiate from a date format and its related string.
Period::fromIso8601now supports truncated date and duration in the interval string.
- None
- None
5.0.0 - 2022-02-22
IntervalErrorused as the error interface marker.InvalidIntervalexception for anything regarding creating an object.Duration::fromSecondsuses a dedicated fraction parameter and the seconds are no longer expressed using afloatvalue.Period::fromTimestampto instantiate a time range object from two timestamps.Period::fromIso80000to instantiate a time range object from a mathematical representation and a date format.Period::fromBourbakito instantiate a time range object from a mathematical representation and a date format.Periodduration comparison methods accepts alsoDurationandDateIntervalin addition toPeriodobjects.Period::unionPeriod::snapTo*methods to ease period expansion.Period::meetsPeriod::meetsOnStartPeriod::meetsOnEndPeriod::toBourbakiPeriod::toIso80000Period::toBourbakiBoundsEnumeration.InitialDatePresenceEnumeration.Sequence::toListChart\LetterCaseEnumeration.Chart\AlignmentEnumeration.Chart\StreamOutputclass to replaceChart\ConsoleOutputclass.Chart\TerminalEnumeration.Chart\ChartErrorused as the chart error interface marker.Chart\UnableToDrawChartexception for anything regarding drawing a chart out ofPeriodand/orSequenceobjects.
- Switch from using
Closureobject instead of thecallablepseudo type with theSequencemethods. Period::diffreturns aSequenceinstance instead of an array.Period::__constructis private.Periodnamed constructors, all parameters are required except for the boundaries.Period::timeDurationnow returns anintinstead of afloatvalue.Period::intersectnow can take multiplePeriodinstances as parameters.Period::subtractnow can take multiplePeriodinstances as parameters.Durationno longer extends aDateIntervalobject.Duration::fromIsoStringsupports 3 versions of dealing with fractions with ISO valid string.Datepointclass renamedDatePoint.DatePointno longer extends aDateTimeImmutableobject.- Argument names are normalized throughout the package. (PHP8 BC break)
Chart\LatinLetterin case of wrong value will fall back toAinstead of0which is not a letter.Chart\LatinLetterthe starting label must be explicit on instantiation.Chart\RomanNumberrequires its two arguments to be explicitly set.
- None
- Support for PHP7 and PHP8.0
Period::fromDatepointreplaced byPeriod::fromDatePeriod::getStartDatereplaced by accessing readonly propertyPeriod::startDatePeriod::getEndDatereplaced by accessing readonly propertyPeriod::endDatePeriod::getBoundaryTypereplaced by accessing readonly propertyPeriod::boundsPeriod::getDateIntervalreplaced byPeriod::dateIntervalPeriod::getTimestampIntervalreplaced byPeriod::timeDurationPeriod::withBoundaryTypereplaced byPeriod::boundedByPeriod::isStartIncludedwith no replacement useBounds::isStartIncludedPeriod::isStartExcludedwith no replacement useBounds::isStartIncludedinsteadPeriod::isEndIncludedwith no replacement useBounds::isEndIncludedPeriod::isEndExcludedwith no replacement useBounds::isEndIncludedinsteadPeriod::fromDatePeriodreplaced byPeriod::fromDateRangePeriod::getDatePeriodreplaced byPeriod::dateRangePeriod::getDatePeriodBackwardsreplaced byPeriod::dateRangeBackwardsPeriod::__stringreplaced byPeriod::toIso8601Period::formatreplaced byPeriod::toIso80000Period::splitreplaced byPeriod::splitForwardPeriod::substractusePeriod::subtractinsteadSequence::substractuseSequence::subtractinsteadSequence::getIntersectionsuseSequence::intersectionsinsteadSequence::getGapsuseSequence::gapsinsteadSequence::getBoundariesuseSequence::lengthinsteadSequence::getTotalTimestampIntervaluseSequence::totalTimeDurationinsteadSequence::toArrayuseSequence::toListinsteadDuration::__toStringandDuration::formatwith no replacementDuration::createis removed with no replacementDatepoint::createis removed with no replacement- The
createprefix is removed from theDurationandDatepointnamed constructors. - All charts related classes have their properties exposed as public readonly. All their getters are removed except if they are part of an interface.
Chart\ConsoleOutputreplaced byChart\StreamOutputclass.Chart\RomanNumber::isLoweruseChart\LetterCase::isUpperinstead.Chart\RomanNumber::startingAtuseChart\DecimalNumber::startLabelpublic readonly propertyChart\RomanNumber::startsWithis removed with no replacementChart\RomanNumber::withLetterCaseis removed with no replacementChart\DecimalNumber::startsWithis removed with no replacementChart\LatinNumber::startsWithis removed with no replacementChart\LatinNumber::startingAtuseChart\LatinNumber::startLabelpublic readonly propertyChart\AffixLabel::withPrefixis removed with no replacementChart\AffixLabel::withSuffixis removed with no replacementChart\AffixLabel::prefixmethod useChart\AffixLabel::labelPrefixpublic readonly propertyChart\AffixLabel::suffixmethod useChart\AffixLabel::labelSuffixpublic readonly property
Removed all the following namespaced functions from the package:
League\Period\datepointLeague\Period\durationLeague\Period\yearLeague\Period\semesterLeague\Period\quarterLeague\Period\monthLeague\Period\dayLeague\Period\hourLeague\Period\minuteLeague\Period\secondLeague\Period\instantLeague\Period\iso_yearLeague\Period\iso_weekLeague\Period\interval_afterLeague\Period\interval_beforeLeague\Period\interval_aroundLeague\Period\interval_from_dateperiod
4.12.0 - 2022-02-21
Datepoint::secondDatepoint::minuteDatepoint::hourDatepoint::isoWeekDatepoint::monthDatepoint::quarterDatepoint::semesterDatepoint::yearDatepoint::isoYearDuration::fromDateIntervalDuration::fromSecondsDuration::fromChronoStringDuration::fromTimeStringDuration::fromDateStringPeriod::timeDurationPeriod::dateIntervalPeriod::dateRangeForwardPeriod::dateRangeBackwardsPeriod::toIso80000Period::splitForwardPeriod::timeDurationDiffPeriod::boundedBySequence::lengthSequence::totalTimeDuration
- None
Datepoint::getSecondis deprecated in favor ofDatepoint::secondDatepoint::getMinuteis deprecated in favor ofDatepoint::minuteDatepoint::getHouris deprecated in favor ofDatepoint::hourDatepoint::getIsoWeekis deprecated in favor ofDatepoint::isoWeekDatepoint::getMonthis deprecated in favor ofDatepoint::monthDatepoint::getQuarteris deprecated in favor ofDatepoint::quarterDatepoint::getSemesteris deprecated in favor ofDatepoint::semesterDatepoint::getYearis deprecated in favor ofDatepoint::yearDatepoint::getIsoYearis deprecated in favor ofDatepoint::isoYearDuration::createfromDateIntervalis deprecated in favor ofDatepoint::fromDateIntervalDuration::createfromSecondsis deprecated in favor ofDatepoint::fromSecondsDuration::createfromChronoStringis deprecated in favor ofDatepoint::fromChronoStringDuration::createfromTimeStringis deprecated in favor ofDatepoint::fromTimeStringDuration::createfromDateStringis deprecated in favor ofDatepoint::fromDateStringPeriod::getTimestampIntervalis deprecated in favor ofPeriod::timeDurationPeriod::getDateIntervalis deprecated in favor ofPeriod::dateIntervalPeriod::getDatePeriodis deprecated in favor ofPeriod::dateRangeForwardPeriod::getDatePeriodBackwardsis deprecated in favor ofPeriod::dateRangeBackwardsPeriod::formatis deprecated in favor ofPeriod::toIso80000Period::splitis deprecated in favor ofPeriod::splitForwardPeriod::withBoundaryTypeis deprecated in favor ofPeriod::boundedByPeriod::timestampIntervalDiffis deprecated in favor ofPeriod::timeDurationDiffSequence::boundariesis deprecated in favor ofSequence::lengthSequence::getTotalTimestampIntervalis deprecated in favor ofSequence::totalTimeDuration
- None
4.11.0 - 2020-11-11
Period::fromDatepointDuration::createFromDateIntervalDuration::createFromTimeStringDuration::createFromChronoStringDuration::createFromSecondsDuration::createsupports DateInterval spec strings.- Support for PHP8
Duration::createwhen using a float will now overflow the results up to the Hour unit.
- None
- None
4.10.0 - 2020-03-22
Period::toIso8601- Charts featuring ported from Bakame\Period\Vizualizer
- Fix issue with
Sequence::intersectionsmethod.
Period::__stringreplaced byPeriod::toIso8601
- Support for PHP7.1
4.9.0 - 2019-09-02
-
$boundaryTypeargument added to the following named constructors:Period::fromDayPeriod::fromIsoWeekPeriod::fromMonthPeriod::fromQuarterPeriod::fromSemesterPeriod::fromYearPeriod::fromIsoYear
-
Period::subtract -
Sequence::subtract
- None
Period::substractusePeriod::subtractinsteadSequence::substractuseSequence::subtractinstead
- None
4.8.1 - 2019-07-16
- None
Sequencenegative offsets for a object with only onePeriodinstance issue #85
- None
- None
4.8.0 - 2019-06-20
Datepointmethods returningPeriodobjects supports boundaryTypePeriod::mergesupports empty arguments.Sequence::containssupports empty arguments.Sequence::unshiftsupports empty arguments.Sequence::pushsupports empty arguments.Sequenceclass supports negative offsets.
Duration::adjustedTono longer comparesDateIntervalobjects to be compatible with PHP7.4+
- None
- None
4.7.1 - 2019-05-19
- None
- Improve
Duration::createFromDateStringbug fix to take into account DateInterval::createFromDateString bug fix - Update the development tools to Infection 0.13
- None
- None
4.7.0 - 2019-03-31
Sequence::getTotalTimestampIntervalsee PR #79Period::substractsee PR #80Sequence::substractsee PR #81
- Update
Duration::createFromDateStringto take into account DateInterval::createFromDateString bug fix - Update the development tools to PHPUnit8.0 and PHPstan 0.11
- None
- None
4.6.0 - 2019-03-06
Duration::adjustedTo- Internals: added support for PHP7.4 and PHP8.0 in travis.yml
- None
Duration::withoutCarryOveruseDuration::adjustedToinstead
- None
4.5.0 - 2019-02-03
Datepoint::isBeforeDatepoint::bordersOnStartDatepoint::isStartingDatepoint::isDuringDatepoint::isEndingDatepoint::bordersOnEndDatepoint::isAfterDatepoint::abutsDuration::createnow supports chronometer formatDuration::withoutCarryOver
Period::durationCompareto take into account Timezone and DST
Duration::__toStringuseDuration::formatinstead
- None
4.4.0 - 2019-01-20
- Added support for the boundary type
Period::EXCLUDE_START_INCLUDE_ENDPeriod::INCLUDE_START_EXCLUDE_ENDPeriod::EXCLUDE_ALLPeriod::INCLUDE_ALLPeriod::getBoundaryTypePeriod::isStartExcludedPeriod::isStartIncludedPeriod::isEndExcludedPeriod::isEndIncludedPeriod::withBoundaryTypePeriod::__constructadds the$boundaryTypeargument;Period::afteradds the$boundaryTypeargument;Period::beforeadds the$boundaryTypeargument;Period::aroundadds the$boundaryTypeargument;Period::fromDatePeriodadds the$boundaryTypeargument;
- Added missing Allen's Algebra intervals
Period::bordersOnStartPeriod::bordersOnEndPeriod::isDuringPeriod::isStartedByPeriod::isEndedBy
- Added additional methods to the Sequence class
Sequence::unionsSequence::intersectionsSequence::gapsSequence::boundariesSequence::reduce
- None
Sequence::getIntersectionsuseSequence::intersectionsinsteadSequence::getGapsuseSequence::gapsinsteadSequence::getBoundariesuseSequence::boundariesinstead
- None
4.3.1 - 2019-01-07
- None
Datepoint::createFromFormatsee issue #72
- None
- None
4.3.0 - 2018-12-21
Sequenceimplements theArrayAccessinterface
Sequence::mapmust preserve offset index after modification.
- None
- None
4.2.0 - 2018-12-19
League\Period\DatepointLeague\Period\DurationPeriod::fromIsoYearPeriod::fromYearPeriod::fromSemesterPeriod::fromQuarterPeriod::fromMonthPeriod::fromIsoWeekPeriod::fromDayPeriod::afterPeriod::beforePeriod::aroundPeriod::fromDatePeriodSequence::map
- None
League\Period\datepointLeague\Period\durationLeague\Period\yearLeague\Period\semesterLeague\Period\quarterLeague\Period\monthLeague\Period\dayLeague\Period\hourLeague\Period\minuteLeague\Period\secondLeague\Period\instantLeague\Period\iso_yearLeague\Period\iso_weekLeague\Period\interval_afterLeague\Period\interval_beforeLeague\Period\interval_aroundLeague\Period\interval_from_dateperiod
- None
4.1.0 - 2018-12-07
League\Period\SequenceLeague\Period\InvalidIndex
- None
- None
- None
4.0.1 - 2018-11-30
- None
Period::splitdoes not work with daylight saving see issue #68
- None
- None
4.0.0 - 2018-10-18
Exceptionclass
Period::durationComparePeriod::durationEqualsPeriod::formatPeriod::expandPeriod::equalsPeriod::getDatePeriodBackwards
League\Period\datepointLeague\Period\durationLeague\Period\yearLeague\Period\semesterLeague\Period\quarterLeague\Period\monthLeague\Period\dayLeague\Period\hourLeague\Period\minuteLeague\Period\secondLeague\Period\instantLeague\Period\iso_yearLeague\Period\iso_weekLeague\Period\interval_afterLeague\Period\interval_beforeLeague\Period\interval_aroundLeague\Period\interval_from_dateperiod
- The
Periodclass is now final Period::JsonSerializenow returns datepoint in JavaScript compatible notationPeriod::diffalways returns an array containing two values.- An instance with a duration equals to
DateInterval('PT0S')will contains no datepoint not even its starting datepoint.
- None
- Support for PHP
7.0 Period::nextPeriod::previousPeriod::addPeriod::subPeriod::createFromYearreplaced byLeague\Period\yearPeriod::createFromMonthreplaced byLeague\Period\monthPeriod::createFromWeekreplaced byLeague\Period\iso_weekPeriod::createFromDayreplaced byLeague\Period\dayPeriod::createFromSemesterreplaced byLeague\Period\semesterPeriod::createFromQuarterreplaced byLeague\Period\quarterPeriod::createFromDurationreplaced byLeague\Period\interval_afterPeriod::createFromDurationBeforeEndreplaced byLeague\Period\interval_beforePeriod::sameValueAsreplaced byPeriod::equalsPeriod::sameDurationAsreplaced byPeriod::durationEqualsPeriod::compareDurationreplaced byPeriod::durationComparePeriod::withDurationreplaced byPeriod::withDurationAfterStart
3.4.0 - 2017-11-17
Period::withDurationBeforeEndPeriod::splitBackwards
- None
- None
- None
3.3.0 - 2016-09-19
Period::movePeriod::moveStartDatePeriod::moveEndDate
- None
Period::addyou should usePeriod::moveEndDateinsteadPeriod::subyou should usePeriod::moveEndDateinstead
- None
3.2.0 - 2016-05-09
Period::__set_state- autoloader to use the library without composer
- None
- None
3.1.1 - 2016-02-10
- None
Period::containssee issue #31- microseconds are taken into account when converting
DateTimeInterfaceobjects.
- None
- None
3.1.0 - 2016-02-01
Period::createFromDay
Period::getDatePeriodadding the$optionparameterDateTimetoDateTimeImmutableconvertion improved for PHP 5.6+ version- Bumped version requirement to PHP 5.5.9 because of a bug in
DatePeriodconstructor
- None
- None
3.0.1 - 2015-12-21
- None
Period::containssee issue #28
- None
- None
3.0.0 - 2015-09-02
Periodimplements theJsonSerializableinterfacePeriodcan now be extended
Periodalways returnsDateTimeImmutableobjectsPeriod::splitreturns aGeneratorPeriod::mergeno longer throwsRuntimeException
- None
- support for PHP 5.4
Period::getStartPeriod::getEndPeriod::getRangePeriod::durationPeriod::durationDiff
2.5.1 - 2015-03-06
Periodalways returnsDateTimeobjects even when givenDateTimeImmutableobjects.
2.5.0 - 2015-03-06
Period::splitto split aPeriodobject into smallerPeriodobjectsPeriod::getDatePeriodPeriod::getDateIntervalPeriod::getTimestampIntervalPeriod::getStartDatePeriod::getEndDatePeriod::dateIntervalDiffPeriod::timestampIntervalDiff
DateIntervalvalidation when created from an integer.
Period::getStartyou should usePeriod::getStartDateinsteadPeriod::getEndyou should usePeriod::getEndDateinsteadPeriod::getRangeyou should usePeriod::getDatePeriodinsteadPeriod::durationyou should usePeriod::getDateIntervalorPeriod::getTimestampIntervalinsteadPeriod::durationDiffyou should usePeriod::dateIntervalDifforPeriod::timestampIntervalDiffinstead
- support for PHP 5.3
2.4.0 - 2014-12-18
- Modifying methods:
Period::diff
- Added support for
DateTimeInterfaceinterface
2.3.0 - 2014-12-15
- Named constructor:
Period::createFromDurationBeforeEnd
Period::isBeforePeriod::isAfterbug fixed. must take into account the half-open implementation of aPeriodobject.
2.2.0 - 2014-12-12
- Modifying methods:
Period::gap
- Comparing methods:
Period::abutsPeriod::isAfterPeriod::isBefore
Period::overlapsbug fixed issue #8
2.1.0 - 2014-12-08
- Modifying methods:
Period::nextPeriod::previous
Period::__toStringusing ISO8601 representation
2.0.0 - 2014-10-15
- Change vendor namespace from
PeriodtoLeague\Period - Comparing methods:
Period::sameValueAs,Period::compareDuration,Period::durationGreaterThan,Period::durationLessThan,Period::sameDurationAs,Period::durationDiff
- Modifying methods:
Period::add,Period::sub,Period::intersect
Period::containsnow works withPeriodobjectsPeriod::getDurationaccept an optional parameter$get_as_secondsif used and set totrue, the method will return a integer which represents the duration in seconds.Period::mergenow accepts one or morePeriodobjects to return thePeriodobject which contains all submittedPeriodobjects.
1.0.1 - 2014-10-08
- The
$intervalparameter can also an integer which represents the interval expressed in seconds.
1.0.0 - 2014-09-24
First stable release of Period
0.3.0 - 2014-09-22
- Added methods overlaps and merge
- namespace simplification
0.2.1 - 2014-09-22
- bug fixes
0.2.0 - 2014-09-22
Class name changed from ReportingPeriod to Period
- added the following methods
contains,getRange,setDurationandgetDuration - name consistency applied by removing the (Date reference)
you can feed:
- a
DateTimeor a string when aDateTimeis expected - a
DateIntervalor a string when aDateIntervalis expected