public function testMaxDateEpochSec() { $offset = ZoneOffset::ofTotalSeconds(0); $seconds = LocalDateTime::MAX()->toEpochSecond($offset); $new = LocalDateTime::ofEpochSecond($seconds, 999999999, $offset); $this->assertEquals(LocalDateTime::MAX(), $new); }
public static function init() { self::$MIN = LocalDateTime::MIN()->atOffset(ZoneOffset::MAX()); self::$MAX = LocalDateTime::MAX()->atOffset(ZoneOffset::MIN()); }
/** * Adds a window that applies until the end of time to the builder that can be * used to filter a set of rules. * <p> * This method defines and adds a window to the zone where the standard offset is specified. * The window limits the effect of subsequent additions of transition rules * or fixed savings. If neither rules or fixed savings are added to the window * then the window will default to no savings. * <p> * This must be added after all other windows. * No more windows can be added after this one. * * @param ZoneOffset $standardOffset the standard offset, not null * @return ZoneRulesBuilder $this, for chaining * @throws \LogicException if a forever window has already been added */ public function addWindowForever(ZoneOffset $standardOffset) { return $this->addWindow($standardOffset, LocalDateTime::MAX(), TimeDefinition::WALL()); }
function data_adjustInto() { return [[LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::of(2012, 3, 4, 1, 1, 1, 100), LocalDateTime::of(2012, 3, 4, 23, 5, 0, 0), null], [LocalDateTime::ofMonth(2012, Month::MARCH(), 4, 0, 0), LocalDateTime::of(2012, 3, 4, 1, 1, 1, 100), LocalDateTime::of(2012, 3, 4, 0, 0), null], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MAX(), LocalDateTime::of(2012, 3, 4, 23, 5), null], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MIN(), LocalDateTime::of(2012, 3, 4, 23, 5), null], [LocalDateTime::MAX(), LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MAX(), null], [LocalDateTime::MIN(), LocalDateTime::of(2012, 3, 4, 23, 5), LocalDateTime::MIN(), null], [LocalDateTime::of(2012, 3, 4, 23, 5), OffsetDateTime::of(2210, 2, 2, 0, 0, 0, 0, ZoneOffset::UTC()), OffsetDateTime::of(2012, 3, 4, 23, 5, 0, 0, ZoneOffset::UTC()), null], [LocalDateTime::of(2012, 3, 4, 23, 5), OffsetDateTime::of(2210, 2, 2, 0, 0, 0, 0, self::OFFSET_PONE()), OffsetDateTime::of(2012, 3, 4, 23, 5, 0, 0, self::OFFSET_PONE()), null], [LocalDateTime::of(2012, 3, 4, 23, 5), ZonedDateTime::of(2210, 2, 2, 0, 0, 0, 0, self::ZONE_PARIS()), ZonedDateTime::of(2012, 3, 4, 23, 5, 0, 0, self::ZONE_PARIS()), null], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalDate::of(2210, 2, 2), null, DateTimeException::class], [LocalDateTime::of(2012, 3, 4, 23, 5), LocalTime::of(22, 3, 0), null, DateTimeException::class], [LocalDateTime::of(2012, 3, 4, 23, 5), OffsetTime::of(22, 3, 0, 0, ZoneOffset::UTC()), null, DateTimeException::class]]; }
/** * Checks if the window is empty. * * @return bool true if the window is only a standard offset */ function isSingleWindowStandardOffset() { return $this->windowEnd->equals(LocalDateTime::MAX()) && $this->timeDefinition == TimeDefinition::WALL() && $this->fixedSavingAmountSecs === null && empty($this->lastRuleList) && empty($this->ruleList); }