/** * Returns a copy of this time with the specified field set to a new value. * <p> * This returns a {@code LocalTime}, based on this one, with the value * for the specified field changed. * This can be used to change any supported field, such as the hour, minute or second. * If it is not possible to set the value, because the field is not supported or for * some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the adjustment is implemented here. * The supported fields behave as follows: * <ul> * <li>{@code NANO_OF_SECOND} - * Returns a {@code LocalTime} with the specified nano-of-second. * The hour, minute and second will be unchanged. * <li>{@code NANO_OF_DAY} - * Returns a {@code LocalTime} with the specified nano-of-day. * This completely replaces the time and is equivalent to {@link #ofNanoOfDay(long)}. * <li>{@code MICRO_OF_SECOND} - * Returns a {@code LocalTime} with the nano-of-second replaced by the specified * micro-of-second multiplied by 1,000. * The hour, minute and second will be unchanged. * <li>{@code MICRO_OF_DAY} - * Returns a {@code LocalTime} with the specified micro-of-day. * This completely replaces the time and is equivalent to using {@link #ofNanoOfDay(long)} * with the micro-of-day multiplied by 1,000. * <li>{@code MILLI_OF_SECOND} - * Returns a {@code LocalTime} with the nano-of-second replaced by the specified * milli-of-second multiplied by 1,000,000. * The hour, minute and second will be unchanged. * <li>{@code MILLI_OF_DAY} - * Returns a {@code LocalTime} with the specified milli-of-day. * This completely replaces the time and is equivalent to using {@link #ofNanoOfDay(long)} * with the milli-of-day multiplied by 1,000,000. * <li>{@code SECOND_OF_MINUTE} - * Returns a {@code LocalTime} with the specified second-of-minute. * The hour, minute and nano-of-second will be unchanged. * <li>{@code SECOND_OF_DAY} - * Returns a {@code LocalTime} with the specified second-of-day. * The nano-of-second will be unchanged. * <li>{@code MINUTE_OF_HOUR} - * Returns a {@code LocalTime} with the specified minute-of-hour. * The hour, second-of-minute and nano-of-second will be unchanged. * <li>{@code MINUTE_OF_DAY} - * Returns a {@code LocalTime} with the specified minute-of-day. * The second-of-minute and nano-of-second will be unchanged. * <li>{@code HOUR_OF_AMPM} - * Returns a {@code LocalTime} with the specified hour-of-am-pm. * The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged. * <li>{@code CLOCK_HOUR_OF_AMPM} - * Returns a {@code LocalTime} with the specified clock-hour-of-am-pm. * The AM/PM, minute-of-hour, second-of-minute and nano-of-second will be unchanged. * <li>{@code HOUR_OF_DAY} - * Returns a {@code LocalTime} with the specified hour-of-day. * The minute-of-hour, second-of-minute and nano-of-second will be unchanged. * <li>{@code CLOCK_HOUR_OF_DAY} - * Returns a {@code LocalTime} with the specified clock-hour-of-day. * The minute-of-hour, second-of-minute and nano-of-second will be unchanged. * <li>{@code AMPM_OF_DAY} - * Returns a {@code LocalTime} with the specified AM/PM. * The hour-of-am-pm, minute-of-hour, second-of-minute and nano-of-second will be unchanged. * </ul> * <p> * In all cases, if the new value is outside the valid range of values for the field * then a {@code DateTimeException} will be thrown. * <p> * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.adjustInto(Temporal, long)} * passing {@code this} as the argument. In this case, the field determines * whether and how to adjust the instant. * <p> * This instance is immutable and unaffected by this method call. * * @param TemporalField $field the field to set in the result, not null * @param int $newValue the new value of the field in the result * @return LocalTime a {@code LocalTime} based on {@code this} with the specified field set, not null * @throws DateTimeException if the field cannot be set * @throws UnsupportedTemporalTypeException if the field is not supported * @throws ArithmeticException if numeric overflow occurs */ public function with(TemporalField $field, $newValue) { if ($field instanceof ChronoField) { $f = $field; $f->checkValidValue($newValue); switch ($f) { case ChronoField::NANO_OF_SECOND(): return $this->withNano((int) $newValue); case ChronoField::NANO_OF_DAY(): return self::ofNanoOfDay($newValue); case ChronoField::MICRO_OF_SECOND(): return $this->withNano((int) $newValue * 1000); case ChronoField::MICRO_OF_DAY(): return self::ofNanoOfDay($newValue * 1000); case ChronoField::MILLI_OF_SECOND(): return $this->withNano((int) $newValue * 1000000); case ChronoField::MILLI_OF_DAY(): return self::ofNanoOfDay($newValue * 1000000); case ChronoField::SECOND_OF_MINUTE(): return $this->withSecond((int) $newValue); case ChronoField::SECOND_OF_DAY(): return $this->plusSeconds($newValue - $this->toSecondOfDay()); case ChronoField::MINUTE_OF_HOUR(): return $this->withMinute((int) $newValue); case ChronoField::MINUTE_OF_DAY(): return $this->plusMinutes($newValue - ($this->hour * 60 + $this->minute)); case ChronoField::HOUR_OF_AMPM(): return $this->plusHours($newValue - $this->hour % 12); case ChronoField::CLOCK_HOUR_OF_AMPM(): return $this->plusHours(($newValue === 12 ? 0 : $newValue) - $this->hour % 12); case ChronoField::HOUR_OF_DAY(): return $this->withHour((int) $newValue); case ChronoField::CLOCK_HOUR_OF_DAY(): return $this->withHour((int) ($newValue === 24 ? 0 : $newValue)); case ChronoField::AMPM_OF_DAY(): return $this->plusHours(($newValue - Math::div($this->hour, 12)) * 12); } throw new UnsupportedTemporalTypeException("Unsupported field: " . $field); } return $field->adjustInto($this, $newValue); }
function data_fieldBased() { return [[CF::DAY_OF_WEEK(), true, false], [CF::ALIGNED_DAY_OF_WEEK_IN_MONTH(), true, false], [CF::ALIGNED_DAY_OF_WEEK_IN_YEAR(), true, false], [CF::DAY_OF_MONTH(), true, false], [CF::DAY_OF_YEAR(), true, false], [CF::EPOCH_DAY(), true, false], [CF::ALIGNED_WEEK_OF_MONTH(), true, false], [CF::ALIGNED_WEEK_OF_YEAR(), true, false], [CF::MONTH_OF_YEAR(), true, false], [CF::PROLEPTIC_MONTH(), true, false], [CF::YEAR_OF_ERA(), true, false], [CF::YEAR(), true, false], [CF::ERA(), true, false], [CF::AMPM_OF_DAY(), false, true], [CF::CLOCK_HOUR_OF_DAY(), false, true], [CF::HOUR_OF_DAY(), false, true], [CF::CLOCK_HOUR_OF_AMPM(), false, true], [CF::HOUR_OF_AMPM(), false, true], [CF::MINUTE_OF_DAY(), false, true], [CF::MINUTE_OF_HOUR(), false, true], [CF::SECOND_OF_DAY(), false, true], [CF::SECOND_OF_MINUTE(), false, true], [CF::MILLI_OF_DAY(), false, true], [CF::MILLI_OF_SECOND(), false, true], [CF::MICRO_OF_DAY(), false, true], [CF::MICRO_OF_SECOND(), false, true], [CF::NANO_OF_DAY(), false, true], [CF::NANO_OF_SECOND(), false, true]]; }
public function test_isSupported_TemporalField() { // TODO $this->assertEquals($this->TEST_DATE_TIME->isSupported(null), false); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::NANO_OF_SECOND()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::NANO_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MICRO_OF_SECOND()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MICRO_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MILLI_OF_SECOND()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MILLI_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::SECOND_OF_MINUTE()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::SECOND_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MINUTE_OF_HOUR()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MINUTE_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::HOUR_OF_AMPM()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::CLOCK_HOUR_OF_AMPM()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::HOUR_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::CLOCK_HOUR_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::AMPM_OF_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::DAY_OF_WEEK()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::ALIGNED_DAY_OF_WEEK_IN_MONTH()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::ALIGNED_DAY_OF_WEEK_IN_YEAR()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::DAY_OF_MONTH()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::DAY_OF_YEAR()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::EPOCH_DAY()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::ALIGNED_WEEK_OF_MONTH()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::ALIGNED_WEEK_OF_YEAR()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::MONTH_OF_YEAR()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::PROLEPTIC_MONTH()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::YEAR()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::YEAR_OF_ERA()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::ERA()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::INSTANT_SECONDS()), true); $this->assertEquals($this->TEST_DATE_TIME->isSupported(CF::OFFSET_SECONDS()), true); }
private function resolveTimeFields() { // simplify fields if ($this->fieldValues->has(CF::CLOCK_HOUR_OF_DAY())) { // lenient allows anything, smart allows 0-24, strict allows 1-24 $ch = $this->fieldValues->remove(CF::CLOCK_HOUR_OF_DAY()); if ($this->resolverStyle == ResolverStyle::STRICT() || $this->resolverStyle == ResolverStyle::SMART() && $ch != 0) { CF::CLOCK_HOUR_OF_DAY()->checkValidValue($ch); } $this->updateCheckConflict3(CF::CLOCK_HOUR_OF_DAY(), CF::HOUR_OF_DAY(), $ch == 24 ? 0 : $ch); } if ($this->fieldValues->has(CF::CLOCK_HOUR_OF_AMPM())) { // lenient allows anything, smart allows 0-12, strict allows 1-12 $ch = $this->fieldValues->remove(CF::CLOCK_HOUR_OF_AMPM()); if ($this->resolverStyle == ResolverStyle::STRICT() || $this->resolverStyle == ResolverStyle::SMART() && $ch != 0) { CF::CLOCK_HOUR_OF_AMPM()->checkValidValue($ch); } $this->updateCheckConflict3(CF::CLOCK_HOUR_OF_AMPM(), CF::HOUR_OF_AMPM(), $ch == 12 ? 0 : $ch); } if ($this->fieldValues->has(CF::AMPM_OF_DAY()) && $this->fieldValues->has(CF::HOUR_OF_AMPM())) { $ap = $this->fieldValues->remove(CF::AMPM_OF_DAY()); $hap = $this->fieldValues->remove(CF::HOUR_OF_AMPM()); if ($this->resolverStyle == ResolverStyle::LENIENT()) { $this->updateCheckConflict3(CF::AMPM_OF_DAY(), CF::HOUR_OF_DAY(), Math::addExact(Math::multiplyExact($ap, 12), $hap)); } else { // STRICT or SMART CF::AMPM_OF_DAY()->checkValidValue($ap); CF::HOUR_OF_AMPM()->checkValidValue($ap); $this->updateCheckConflict3(CF::AMPM_OF_DAY(), CF::HOUR_OF_DAY(), $ap * 12 + $hap); } } if ($this->fieldValues->has(CF::NANO_OF_DAY())) { $nod = $this->fieldValues->remove(CF::NANO_OF_DAY()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::NANO_OF_DAY()->checkValidValue($nod); } $this->updateCheckConflict3(CF::NANO_OF_DAY(), CF::HOUR_OF_DAY(), Math::div($nod, 3600000000000)); $this->updateCheckConflict3(CF::NANO_OF_DAY(), CF::MINUTE_OF_HOUR(), Math::div($nod, 60000000000) % 60); $this->updateCheckConflict3(CF::NANO_OF_DAY(), CF::SECOND_OF_MINUTE(), Math::div($nod, 1000000000) % 60); $this->updateCheckConflict3(CF::NANO_OF_DAY(), CF::NANO_OF_SECOND(), $nod % 1000000000); } if ($this->fieldValues->has(CF::MICRO_OF_DAY())) { $cod = $this->fieldValues->remove(CF::MICRO_OF_DAY()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::MICRO_OF_DAY()->checkValidValue($cod); } $this->updateCheckConflict3(CF::MICRO_OF_DAY(), CF::SECOND_OF_DAY(), Math::div($cod, 1000000)); $this->updateCheckConflict3(CF::MICRO_OF_DAY(), CF::MICRO_OF_SECOND(), $cod % 1000000); } if ($this->fieldValues->has(CF::MILLI_OF_DAY())) { $lod = $this->fieldValues->remove(CF::MILLI_OF_DAY()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::MILLI_OF_DAY()->checkValidValue($lod); } $this->updateCheckConflict3(CF::MILLI_OF_DAY(), CF::SECOND_OF_DAY(), Math::div($lod, 1000)); $this->updateCheckConflict3(CF::MILLI_OF_DAY(), CF::MILLI_OF_SECOND(), $lod % 1000); } if ($this->fieldValues->has(CF::SECOND_OF_DAY())) { $sod = $this->fieldValues->remove(CF::SECOND_OF_DAY()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::SECOND_OF_DAY()->checkValidValue($sod); } $this->updateCheckConflict3(CF::SECOND_OF_DAY(), CF::HOUR_OF_DAY(), Math::div($sod, 3600)); $this->updateCheckConflict3(CF::SECOND_OF_DAY(), CF::MINUTE_OF_HOUR(), Math::div($sod, 60) % 60); $this->updateCheckConflict3(CF::SECOND_OF_DAY(), CF::SECOND_OF_MINUTE(), $sod % 60); } if ($this->fieldValues->has(CF::MINUTE_OF_DAY())) { $mod = $this->fieldValues->remove(CF::MINUTE_OF_DAY()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::MINUTE_OF_DAY()->checkValidValue($mod); } $this->updateCheckConflict3(CF::MINUTE_OF_DAY(), CF::HOUR_OF_DAY(), Math::div($mod, 60)); $this->updateCheckConflict3(CF::MINUTE_OF_DAY(), CF::MINUTE_OF_HOUR(), $mod % 60); } // combine partial second fields strictly, leaving lenient expansion to later if ($this->fieldValues->has(CF::NANO_OF_SECOND())) { $nos = $this->fieldValues->get(CF::NANO_OF_SECOND()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::NANO_OF_SECOND()->checkValidValue($nos); } if ($this->fieldValues->has(CF::MICRO_OF_SECOND())) { $cos = $this->fieldValues->remove(CF::MICRO_OF_SECOND()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::MICRO_OF_SECOND()->checkValidValue($cos); } $nos = $cos * 1000 + $nos % 1000; $this->updateCheckConflict3(CF::MICRO_OF_SECOND(), CF::NANO_OF_SECOND(), $nos); } if ($this->fieldValues->has(CF::MILLI_OF_SECOND())) { $los = $this->fieldValues->remove(CF::MILLI_OF_SECOND()); if ($this->resolverStyle != ResolverStyle::LENIENT()) { CF::MILLI_OF_SECOND()->checkValidValue($los); } $this->updateCheckConflict3(CF::MILLI_OF_SECOND(), CF::NANO_OF_SECOND(), $los * 1000000 + $nos % 1000000); } } // convert to time if all four fields available (optimization) if ($this->fieldValues->has(CF::HOUR_OF_DAY()) && $this->fieldValues->has(CF::MINUTE_OF_HOUR()) && $this->fieldValues->has(CF::SECOND_OF_MINUTE()) && $this->fieldValues->has(CF::NANO_OF_SECOND())) { $hod = $this->fieldValues->remove(CF::HOUR_OF_DAY()); $moh = $this->fieldValues->remove(CF::MINUTE_OF_HOUR()); $som = $this->fieldValues->remove(CF::SECOND_OF_MINUTE()); $nos = $this->fieldValues->remove(CF::NANO_OF_SECOND()); $this->resolveTime($hod, $moh, $som, $nos); } }
/** * @dataProvider data_resolveClockHourOfDay */ public function test_resolveClockHourOfDay(ResolverStyle $style, $value, $expectedHour, $expectedDays) { $str = strval($value); $f = (new DateTimeFormatterBuilder())->appendValue(ChronoField::CLOCK_HOUR_OF_DAY())->toFormatter(); if ($expectedHour !== null) { $accessor = $f->withResolverStyle($style)->parse($str); $this->assertEquals($accessor->query(TemporalQueries::localDate()), null); $this->assertEquals($accessor->query(TemporalQueries::localTime()), LocalTime::of($expectedHour, 0)); $this->assertEquals($accessor->query(DateTimeFormatter::parsedExcessDays()), Period::ofDays($expectedDays)); } else { try { $f->withResolverStyle($style)->parse($str); $this->fail(); } catch (DateTimeParseException $ex) { // $expected } } }
public function test_isSupported_TemporalField() { // TODO check //$this->assertEquals(TEST_2008.isSupported((TemporalField) null()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::NANO_OF_SECOND()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::NANO_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MICRO_OF_SECOND()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MICRO_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MILLI_OF_SECOND()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MILLI_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::SECOND_OF_MINUTE()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::SECOND_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MINUTE_OF_HOUR()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MINUTE_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::HOUR_OF_AMPM()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::CLOCK_HOUR_OF_AMPM()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::HOUR_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::CLOCK_HOUR_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::AMPM_OF_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::DAY_OF_WEEK()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::ALIGNED_DAY_OF_WEEK_IN_YEAR()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::DAY_OF_MONTH()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::DAY_OF_YEAR()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::EPOCH_DAY()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::ALIGNED_WEEK_OF_MONTH()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::ALIGNED_WEEK_OF_YEAR()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::MONTH_OF_YEAR()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::PROLEPTIC_MONTH()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::YEAR()), true); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::YEAR_OF_ERA()), true); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::ERA()), true); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::INSTANT_SECONDS()), false); $this->assertEquals(self::$TEST_2008->isSupported(ChronoField::OFFSET_SECONDS()), false); }
function data_withTemporalField_outOfRange() { return [[CF::NANO_OF_SECOND(), $this->time(0, 0, 0, 0), CF::NANO_OF_SECOND()->range()->getMinimum() - 1], [CF::NANO_OF_SECOND(), $this->time(0, 0, 0, 0), CF::NANO_OF_SECOND()->range()->getMaximum() + 1], [CF::NANO_OF_DAY(), $this->time(0, 0, 0, 0), CF::NANO_OF_DAY()->range()->getMinimum() - 1], [CF::NANO_OF_DAY(), $this->time(0, 0, 0, 0), CF::NANO_OF_DAY()->range()->getMaximum() + 1], [CF::MICRO_OF_SECOND(), $this->time(0, 0, 0, 0), CF::MICRO_OF_SECOND()->range()->getMinimum() - 1], [CF::MICRO_OF_SECOND(), $this->time(0, 0, 0, 0), CF::MICRO_OF_SECOND()->range()->getMaximum() + 1], [CF::MICRO_OF_DAY(), $this->time(0, 0, 0, 0), CF::MICRO_OF_DAY()->range()->getMinimum() - 1], [CF::MICRO_OF_DAY(), $this->time(0, 0, 0, 0), CF::MICRO_OF_DAY()->range()->getMaximum() + 1], [CF::MILLI_OF_SECOND(), $this->time(0, 0, 0, 0), CF::MILLI_OF_SECOND()->range()->getMinimum() - 1], [CF::MILLI_OF_SECOND(), $this->time(0, 0, 0, 0), CF::MILLI_OF_SECOND()->range()->getMaximum() + 1], [CF::MILLI_OF_DAY(), $this->time(0, 0, 0, 0), CF::MILLI_OF_DAY()->range()->getMinimum() - 1], [CF::MILLI_OF_DAY(), $this->time(0, 0, 0, 0), CF::MILLI_OF_DAY()->range()->getMaximum() + 1], [CF::SECOND_OF_MINUTE(), $this->time(0, 0, 0, 0), CF::SECOND_OF_MINUTE()->range()->getMinimum() - 1], [CF::SECOND_OF_MINUTE(), $this->time(0, 0, 0, 0), CF::SECOND_OF_MINUTE()->range()->getMaximum() + 1], [CF::SECOND_OF_DAY(), $this->time(0, 0, 0, 0), CF::SECOND_OF_DAY()->range()->getMinimum() - 1], [CF::SECOND_OF_DAY(), $this->time(0, 0, 0, 0), CF::SECOND_OF_DAY()->range()->getMaximum() + 1], [CF::MINUTE_OF_HOUR(), $this->time(0, 0, 0, 0), CF::MINUTE_OF_HOUR()->range()->getMinimum() - 1], [CF::MINUTE_OF_HOUR(), $this->time(0, 0, 0, 0), CF::MINUTE_OF_HOUR()->range()->getMaximum() + 1], [CF::MINUTE_OF_DAY(), $this->time(0, 0, 0, 0), CF::MINUTE_OF_DAY()->range()->getMinimum() - 1], [CF::MINUTE_OF_DAY(), $this->time(0, 0, 0, 0), CF::MINUTE_OF_DAY()->range()->getMaximum() + 1], [CF::HOUR_OF_AMPM(), $this->time(0, 0, 0, 0), CF::HOUR_OF_AMPM()->range()->getMinimum() - 1], [CF::HOUR_OF_AMPM(), $this->time(0, 0, 0, 0), CF::HOUR_OF_AMPM()->range()->getMaximum() + 1], [CF::CLOCK_HOUR_OF_AMPM(), $this->time(0, 0, 0, 0), CF::CLOCK_HOUR_OF_AMPM()->range()->getMinimum() - 1], [CF::CLOCK_HOUR_OF_AMPM(), $this->time(0, 0, 0, 0), CF::CLOCK_HOUR_OF_AMPM()->range()->getMaximum() + 1], [CF::HOUR_OF_DAY(), $this->time(0, 0, 0, 0), CF::HOUR_OF_DAY()->range()->getMinimum() - 1], [CF::HOUR_OF_DAY(), $this->time(0, 0, 0, 0), CF::HOUR_OF_DAY()->range()->getMaximum() + 1], [CF::CLOCK_HOUR_OF_DAY(), $this->time(0, 0, 0, 0), CF::CLOCK_HOUR_OF_DAY()->range()->getMinimum() - 1], [CF::CLOCK_HOUR_OF_DAY(), $this->time(0, 0, 0, 0), CF::CLOCK_HOUR_OF_DAY()->range()->getMaximum() + 1], [CF::AMPM_OF_DAY(), $this->time(0, 0, 0, 0), CF::AMPM_OF_DAY()->range()->getMinimum() - 1], [CF::AMPM_OF_DAY(), $this->time(0, 0, 0, 0), CF::AMPM_OF_DAY()->range()->getMaximum() + 1]]; }
public static function init() { self::$FIELD_MAP = ['G' => ChronoField::ERA(), 'y' => ChronoField::YEAR_OF_ERA(), 'u' => ChronoField::YEAR(), 'Q' => IsoFields::QUARTER_OF_YEAR(), 'q' => IsoFields::QUARTER_OF_YEAR(), 'M' => ChronoField::MONTH_OF_YEAR(), 'L' => ChronoField::MONTH_OF_YEAR(), 'D' => ChronoField::DAY_OF_YEAR(), 'd' => ChronoField::DAY_OF_MONTH(), 'F' => ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH(), 'E' => ChronoField::DAY_OF_WEEK(), 'c' => ChronoField::DAY_OF_WEEK(), 'e' => ChronoField::DAY_OF_WEEK(), 'a' => ChronoField::AMPM_OF_DAY(), 'H' => ChronoField::HOUR_OF_DAY(), 'k' => ChronoField::CLOCK_HOUR_OF_DAY(), 'K' => ChronoField::HOUR_OF_AMPM(), 'h' => ChronoField::CLOCK_HOUR_OF_AMPM(), 'm' => ChronoField::MINUTE_OF_HOUR(), 's' => ChronoField::SECOND_OF_MINUTE(), 'S' => ChronoField::NANO_OF_SECOND(), 'A' => ChronoField::MILLI_OF_DAY(), 'n' => ChronoField::NANO_OF_SECOND(), 'N' => ChronoField::NANO_OF_DAY()]; }