예제 #1
0
 public function adjustInto(Temporal $temporal, $newValue)
 {
     if ($this->isSupportedBy($temporal) === false) {
         throw new UnsupportedTemporalTypeException("Unsupported field: WeekBasedYear");
     }
     $newWby = $this->range()->checkValidIntValue($newValue, IsoFields::WEEK_BASED_YEAR());
     // strict check
     $date = LocalDate::from($temporal);
     $dow = $date->get(ChronoField::DAY_OF_WEEK());
     $week = IsoFields::getWeek($date);
     if ($week == 53 && IsoFields::getWeekRangeInt($newWby) == 52) {
         $week = 52;
     }
     $resolved = LocalDate::of($newWby, 1, 4);
     // 4th is guaranteed to be in week one
     $days = $dow - $resolved->get(ChronoField::DAY_OF_WEEK()) + ($week - 1) * 7;
     $resolved = $resolved->plusDays($days);
     return $temporal->adjust($resolved);
 }
 public function test_optionalEnd2()
 {
     $this->builder->appendValue(CF::MONTH_OF_YEAR())->optionalStart()->appendValue(CF::DAY_OF_MONTH())->optionalStart()->appendValue(CF::DAY_OF_WEEK())->optionalEnd()->appendValue(CF::DAY_OF_MONTH())->optionalEnd();
     $f = $this->builder->toFormatter();
     $this->assertEquals($f->__toString(), "Value(MonthOfYear)[Value(DayOfMonth)[Value(DayOfWeek)]Value(DayOfMonth)]");
 }
 public function test_resolverFields_ignoreCrossCheck()
 {
     $base = (new DateTimeFormatterBuilder())->appendValue(CF::YEAR())->appendLiteral('-')->appendValue(CF::DAY_OF_YEAR())->appendLiteral('-')->appendValue(CF::DAY_OF_WEEK())->toFormatter();
     $f = $base->withResolverFields(CF::YEAR(), CF::DAY_OF_YEAR());
     try {
         $base->parseQuery("2012-321-1", TemporalQueries::fromCallable([LocalDate::class, 'from']));
         // wrong day-of-week
         $this->fail();
     } catch (DateTimeException $ex) {
         // $expected, should $this->fail() in cross-check of day-of-week
     }
     $parsed = $f->parseQuery("2012-321-1", TemporalQueries::fromCallable([LocalDate::class, 'from']));
     // ignored wrong day-of-week
     $this->assertEquals($parsed, LocalDate::of(2012, 11, 16));
 }
 public function test_getLong_TemporalField()
 {
     $test = ZonedDateTime::ofDateTime(LocalDateTime::of(2008, 6, 30, 12, 30, 40, 987654321), self::ZONE_0100());
     $this->assertEquals($test->getLong(CF::YEAR()), 2008);
     $this->assertEquals($test->getLong(CF::MONTH_OF_YEAR()), 6);
     $this->assertEquals($test->getLong(CF::DAY_OF_MONTH()), 30);
     $this->assertEquals($test->getLong(CF::DAY_OF_WEEK()), 1);
     $this->assertEquals($test->getLong(CF::DAY_OF_YEAR()), 182);
     $this->assertEquals($test->getLong(CF::HOUR_OF_DAY()), 12);
     $this->assertEquals($test->getLong(CF::MINUTE_OF_HOUR()), 30);
     $this->assertEquals($test->getLong(CF::SECOND_OF_MINUTE()), 40);
     $this->assertEquals($test->getLong(CF::NANO_OF_SECOND()), 987654321);
     $this->assertEquals($test->getLong(CF::HOUR_OF_AMPM()), 0);
     $this->assertEquals($test->getLong(CF::AMPM_OF_DAY()), 1);
     $this->assertEquals($test->getLong(CF::OFFSET_SECONDS()), 3600);
     $this->assertEquals($test->getLong(CF::INSTANT_SECONDS()), $test->toEpochSecond());
 }
예제 #5
0
 public function test_isSupported_TemporalField()
 {
     // TODO $this->assertEquals(self::TEST_2008_06()->isSupported(null), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::NANO_OF_SECOND()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::NANO_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MICRO_OF_SECOND()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MICRO_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MILLI_OF_SECOND()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MILLI_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::SECOND_OF_MINUTE()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::SECOND_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MINUTE_OF_HOUR()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MINUTE_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::HOUR_OF_AMPM()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::CLOCK_HOUR_OF_AMPM()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::HOUR_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::CLOCK_HOUR_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::AMPM_OF_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::DAY_OF_WEEK()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::ALIGNED_DAY_OF_WEEK_IN_MONTH()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::ALIGNED_DAY_OF_WEEK_IN_YEAR()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::DAY_OF_MONTH()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::DAY_OF_YEAR()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::EPOCH_DAY()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::ALIGNED_WEEK_OF_MONTH()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::ALIGNED_WEEK_OF_YEAR()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::MONTH_OF_YEAR()), true);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::PROLEPTIC_MONTH()), true);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::YEAR()), true);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::YEAR_OF_ERA()), true);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::ERA()), true);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::INSTANT_SECONDS()), false);
     $this->assertEquals(self::TEST_2008_06()->isSupported(CF::OFFSET_SECONDS()), false);
 }
 function data_text()
 {
     return [[ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 1, "Monday"], [ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 2, "Tuesday"], [ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 3, "Wednesday"], [ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 4, "Thursday"], [ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 5, "Friday"], [ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 6, "Saturday"], [ChronoField::DAY_OF_WEEK(), TextStyle::FULL(), 7, "Sunday"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 1, "Mon"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 2, "Tue"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 3, "Wed"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 4, "Thu"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 5, "Fri"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 6, "Sat"], [ChronoField::DAY_OF_WEEK(), TextStyle::SHORT(), 7, "Sun"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 1, "1"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 2, "2"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 3, "3"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 28, "28"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 29, "29"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 30, "30"], [ChronoField::DAY_OF_MONTH(), TextStyle::FULL(), 31, "31"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 1, "1"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 2, "2"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 3, "3"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 28, "28"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 29, "29"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 30, "30"], [ChronoField::DAY_OF_MONTH(), TextStyle::SHORT(), 31, "31"], [ChronoField::MONTH_OF_YEAR(), TextStyle::FULL(), 1, "January"], [ChronoField::MONTH_OF_YEAR(), TextStyle::FULL(), 12, "December"], [ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT(), 1, "Jan"], [ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT(), 12, "Dec"]];
 }
예제 #7
0
 /**
  * @expectedException \Celest\DateTimeException
  */
 public function test_with_TemporalField_long_invalidValue()
 {
     self::TEST_2007_07_15()->with(CF::DAY_OF_WEEK(), -1);
 }
예제 #8
0
 /**
  * @dataProvider data_parseLenientWeek
  */
 public function test_parse_parseLenientWeek_LENIENT($str, LocalDate $expected, $smart)
 {
     $f = (new DateTimeFormatterBuilder())->appendValue(IsoFields::WEEK_BASED_YEAR())->appendLiteral(':')->appendValue(IsoFields::WEEK_OF_WEEK_BASED_YEAR())->appendLiteral(':')->appendValue(CF::DAY_OF_WEEK())->toFormatter()->withResolverStyle(ResolverStyle::LENIENT());
     $parsed = LocalDate::parseWith($str, $f);
     $this->assertEquals($parsed, $expected);
 }
 /**
  * Gets an iterator of text to field for the specified field, locale and style
  * for the purpose of parsing.
  * <p>
  * The iterator must be returned in order from the longest text to the shortest.
  * <p>
  * The null return value should be used if there is no applicable parsable text, or
  * if the text would be a numeric representation of the value.
  * Text can only be parsed if all the values for that field-style-locale combination are unique.
  *
  * @param TemporalField $field the field to get text for, not null
  * @param TextStyle $style the style to get text for, null for all parsable text
  * @param Locale $locale the locale to get text for, not null
  * @return array the iterator of text to field pairs, in order from longest text to shortest text,
  *  null if the field or style is not parsable
  */
 public function getTextIterator(TemporalField $field, $style, Locale $locale)
 {
     $values = null;
     if ($field == ChronoField::DAY_OF_WEEK()) {
         $values = self::tryFetchStyleValues('dayNames', $style, $locale, function ($i) {
             return $i === 0 ? 7 : $i;
         });
     }
     if ($field == ChronoField::MONTH_OF_YEAR()) {
         $values = self::tryFetchStyleValues('monthNames', $style, $locale, function ($i) {
             return $i + 1;
         });
     }
     if ($field == IsoFields::QUARTER_OF_YEAR()) {
         $values = self::tryFetchStyleValues('quarters', $style, $locale, function ($i) {
             return $i + 1;
         });
     }
     if ($field == ChronoField::AMPM_OF_DAY()) {
         $values = self::tryFetchStyleValues('AmPmMarkers', $style, $locale, function ($i) {
             return $i;
         });
     }
     if ($values === null) {
         return null;
     }
     \uksort($values, function ($a, $b) {
         return strlen($b) - strlen($a);
     });
     return $values;
 }
예제 #10
0
 /**
  * Returns the previous-or-same day-of-week adjuster, which adjusts the date to the
  * first occurrence of the specified day-of-week before the date being adjusted
  * unless it is already on that day in which case the same object is returned.
  * <p>
  * The ISO calendar system behaves as follows:<br>
  * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).<br>
  * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).<br>
  * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input).
  * <p>
  * The behavior is suitable for use with most calendar systems.
  * It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit,
  * and assumes a seven day week.
  *
  * @param DayOfWeek $dayOfWeek the day-of-week to check for or move the date to, not null
  * @return TemporalAdjuster the previous-or-same day-of-week adjuster, not null
  */
 public static function previousOrSame(DayOfWeek $dayOfWeek)
 {
     $dowValue = $dayOfWeek->getValue();
     return self::fromCallable(function (Temporal $temporal) use($dowValue) {
         $calDow = $temporal->get(ChronoField::DAY_OF_WEEK());
         if ($calDow == $dowValue) {
             return $temporal;
         }
         $daysDiff = $dowValue - $calDow;
         return $temporal->minus($daysDiff >= 0 ? 7 - $daysDiff : -$daysDiff, ChronoUnit::DAYS());
     });
 }
예제 #11
0
 public function isSupportedBy(TemporalAccessor $temporal)
 {
     if ($temporal->isSupported(CF::DAY_OF_WEEK())) {
         if ($this->rangeUnit == ChronoUnit::WEEKS()) {
             // day-of-week
             return true;
         } else {
             if ($this->rangeUnit == ChronoUnit::MONTHS()) {
                 // week-of-month
                 return $temporal->isSupported(CF::DAY_OF_MONTH());
             } else {
                 if ($this->rangeUnit == ChronoUnit::YEARS()) {
                     // week-of-year
                     return $temporal->isSupported(CF::DAY_OF_YEAR());
                 } else {
                     if ($this->rangeUnit == IsoFields::WEEK_BASED_YEARS()) {
                         return $temporal->isSupported(CF::DAY_OF_YEAR());
                     } else {
                         if ($this->rangeUnit == ChronoUnit::FOREVER()) {
                             return $temporal->isSupported(CF::YEAR());
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
 function data_normalized()
 {
     return [[ChronoField::YEAR(), 2127, ChronoField::YEAR(), 2127], [ChronoField::MONTH_OF_YEAR(), 12, ChronoField::MONTH_OF_YEAR(), 12], [ChronoField::DAY_OF_YEAR(), 127, ChronoField::DAY_OF_YEAR(), 127], [ChronoField::DAY_OF_MONTH(), 23, ChronoField::DAY_OF_MONTH(), 23], [ChronoField::DAY_OF_WEEK(), 127, ChronoField::DAY_OF_WEEK(), 127], [ChronoField::ALIGNED_WEEK_OF_YEAR(), 23, ChronoField::ALIGNED_WEEK_OF_YEAR(), 23], [ChronoField::ALIGNED_DAY_OF_WEEK_IN_YEAR(), 4, ChronoField::ALIGNED_DAY_OF_WEEK_IN_YEAR(), 4], [ChronoField::ALIGNED_WEEK_OF_MONTH(), 4, ChronoField::ALIGNED_WEEK_OF_MONTH(), 4], [ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH(), 3, ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH(), 3], [ChronoField::PROLEPTIC_MONTH(), 27, ChronoField::PROLEPTIC_MONTH(), null], [ChronoField::PROLEPTIC_MONTH(), 27, ChronoField::YEAR(), 2], [ChronoField::PROLEPTIC_MONTH(), 27, ChronoField::MONTH_OF_YEAR(), 4]];
 }
 public function test_parse_weekDate_largeYear()
 {
     $parsed = DateTimeFormatter::ISO_WEEK_DATE()->parseUnresolved("+123456-W04-5", new ParsePosition(0));
     $this->assertEquals($parsed->getLong(IsoFields::WEEK_BASED_YEAR()), 123456);
     $this->assertEquals($parsed->getLong(IsoFields::WEEK_OF_WEEK_BASED_YEAR()), 4);
     $this->assertEquals($parsed->getLong(ChronoField::DAY_OF_WEEK()), 5);
 }
예제 #14
0
 function providerStandaloneText()
 {
     // Locale, TemporalField, TextStyle, expected value, input text
     return [[self::RUSSIAN(), ChronoField::MONTH_OF_YEAR(), TextStyle::FULL_STANDALONE(), 1, TestHelper::getRussianJanuary()], [self::RUSSIAN(), ChronoField::MONTH_OF_YEAR(), TextStyle::FULL_STANDALONE(), 12, TestHelper::getRussianDecember()], [self::RUSSIAN(), ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT_STANDALONE(), 1, TestHelper::getRussianJan()], [self::RUSSIAN(), ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT_STANDALONE(), 12, TestHelper::getRussianDec()], [self::FINNISH(), ChronoField::DAY_OF_WEEK(), TextStyle::FULL_STANDALONE(), 2, "tiistai"], [self::FINNISH(), ChronoField::DAY_OF_WEEK(), TextStyle::SHORT_STANDALONE(), 2, "ti"]];
 }
예제 #15
0
 public function test_getLong_TemporalField()
 {
     $this->assertEquals(DayOfWeek::WEDNESDAY()->getLong(ChronoField::DAY_OF_WEEK()), 3);
 }
예제 #16
0
 public static function RFC_1123_DATE_TIME()
 {
     // manually code maps to ensure correct data always used
     // (locale data can be changed by application code)
     $dow = [1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat", 7 => "Sun"];
     $moy = [1 => "Jan", 2 => "Feb", 3 => "Mar", 4 => "Apr", 5 => "May", 6 => "Jun", 7 => "Jul", 8 => "Aug", 9 => "Sep", 10 => "Oct", 11 => "Nov", 12 => "Dec"];
     return self::$RFC_1123_DATE_TIME = (new DateTimeFormatterBuilder())->parseCaseInsensitive()->parseLenient()->optionalStart()->appendText3(ChronoField::DAY_OF_WEEK(), $dow)->appendLiteral2(", ")->optionalEnd()->appendValue3(ChronoField::DAY_OF_MONTH(), 1, 2, SignStyle::NOT_NEGATIVE())->appendLiteral(' ')->appendText3(ChronoField::MONTH_OF_YEAR(), $moy)->appendLiteral(' ')->appendValue2(ChronoField::YEAR(), 4)->appendLiteral(' ')->appendValue2(ChronoField::HOUR_OF_DAY(), 2)->appendLiteral(':')->appendValue2(ChronoField::MINUTE_OF_HOUR(), 2)->optionalStart()->appendLiteral(':')->appendValue2(ChronoField::SECOND_OF_MINUTE(), 2)->optionalEnd()->appendLiteral(' ')->appendOffset("+HHMM", "GMT")->toFormatter3(ResolverStyle::SMART(), IsoChronology::INSTANCE());
 }
예제 #17
0
 /**
  * @dataProvider provider_parseData
  */
 public function test_parse_textField($minWidth, $maxWidth, SignStyle $signStyle, $subsequentWidth, $text, $pos, $expectedPos, $expectedValue)
 {
     $ppos = new ParsePosition($pos);
     $dtf = $this->getFormatterWidth(ChronoField::DAY_OF_WEEK(), $minWidth, $maxWidth, $signStyle);
     if ($subsequentWidth > 0) {
         // hacky, to reserve space
         $dtf = $this->builder->appendValue2(ChronoField::DAY_OF_YEAR(), $subsequentWidth)->toFormatter2($this->locale)->withDecimalStyle($this->decimalStyle);
     }
     $parsed = $dtf->parseUnresolved($text, $ppos);
     if ($ppos->getErrorIndex() != -1) {
         $this->assertEquals($ppos->getErrorIndex(), $expectedPos);
     } else {
         $this->assertTrue($subsequentWidth >= 0);
         $this->assertEquals($ppos->getIndex(), $expectedPos + $subsequentWidth);
         $this->assertEquals($parsed->getLong(ChronoField::DAY_OF_WEEK()), $expectedValue);
         $this->assertEquals($parsed->query(TemporalQueries::chronology()), null);
         $this->assertEquals($parsed->query(TemporalQueries::zoneId()), null);
     }
 }
예제 #18
0
 protected function resolveYAD(FieldValues $fieldValues, ResolverStyle $resolverStyle)
 {
     $y = $this->range(ChronoField::YEAR())->checkValidIntValue($fieldValues->remove(ChronoField::YEAR()), ChronoField::YEAR());
     if ($resolverStyle == ResolverStyle::LENIENT()) {
         $weeks = Math::subtractExact($fieldValues->remove(ChronoField::ALIGNED_WEEK_OF_YEAR()), 1);
         $dow = Math::subtractExact($fieldValues->remove(ChronoField::DAY_OF_WEEK()), 1);
         return $this->resolveAligned($this->dateYearDay($y, 1), 0, $weeks, $dow);
     }
     $aw = $this->range(ChronoField::ALIGNED_WEEK_OF_YEAR())->checkValidIntValue($fieldValues->remove(ChronoField::ALIGNED_WEEK_OF_YEAR()), ChronoField::ALIGNED_WEEK_OF_YEAR());
     $dow = $this->range(ChronoField::DAY_OF_WEEK())->checkValidIntValue($fieldValues->remove(ChronoField::DAY_OF_WEEK()), ChronoField::DAY_OF_WEEK());
     $date = $this->dateYearDay($y, 1)->plus(($aw - 1) * 7, ChronoUnit::DAYS())->adjust(TemporalAdjusters::nextOrSame(DayOfWeek::of($dow)));
     if ($resolverStyle == ResolverStyle::STRICT() && $date->get(ChronoField::YEAR()) != $y) {
         throw new DateTimeException("Strict mode rejected resolved date as it is in a different year");
     }
     return $date;
 }
 function data_resolveFourToDate()
 {
     return [[ChronoField::YEAR(), 2012, ChronoField::MONTH_OF_YEAR(), 2, ChronoField::ALIGNED_WEEK_OF_MONTH(), 1, ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH(), 1, LocalDate::of(2012, 2, 1)], [ChronoField::YEAR(), 2012, ChronoField::MONTH_OF_YEAR(), 2, ChronoField::ALIGNED_WEEK_OF_MONTH(), 1, ChronoField::DAY_OF_WEEK(), 3, LocalDate::of(2012, 2, 1)], [ChronoField::YEAR(), 2012, ChronoField::MONTH_OF_YEAR(), 2, ChronoField::DAY_OF_MONTH(), 1, ChronoField::DAY_OF_WEEK(), 3, LocalDate::of(2012, 2, 1)], [ChronoField::YEAR(), 2012, ChronoField::ALIGNED_WEEK_OF_YEAR(), 5, ChronoField::ALIGNED_DAY_OF_WEEK_IN_YEAR(), 4, ChronoField::DAY_OF_WEEK(), 3, LocalDate::of(2012, 2, 1)], [ChronoField::YEAR(), 2012, ChronoField::ALIGNED_WEEK_OF_YEAR(), 5, ChronoField::DAY_OF_WEEK(), 3, ChronoField::DAY_OF_MONTH(), 1, LocalDate::of(2012, 2, 1)]];
 }
예제 #20
0
 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]];
 }
예제 #21
0
 function data_localeDisplayNames()
 {
     return [[ChronoField::ERA()], [ChronoField::YEAR()], [ChronoField::MONTH_OF_YEAR()], [ChronoField::DAY_OF_WEEK()], [ChronoField::DAY_OF_MONTH()], [ChronoField::AMPM_OF_DAY()], [ChronoField::HOUR_OF_DAY()], [ChronoField::MINUTE_OF_HOUR()], [ChronoField::SECOND_OF_MINUTE()]];
 }
예제 #22
0
 public function resolve(FieldValues $fieldValues, TemporalAccessor $partialTemporal, ResolverStyle $resolverStyle)
 {
     $wbyLong = $fieldValues->get(IsoFields::WEEK_BASED_YEAR());
     $dowLong = $fieldValues->get(ChronoField::DAY_OF_WEEK());
     if ($wbyLong === null || $dowLong === null) {
         return null;
     }
     $wby = IsoFields::WEEK_BASED_YEAR()->range()->checkValidIntValue($wbyLong, IsoFields::WEEK_BASED_YEAR());
     // always validate
     $wowby = $fieldValues->get(IsoFields::WEEK_OF_WEEK_BASED_YEAR());
     IsoFields::ensureIso($partialTemporal);
     $date = LocalDate::of($wby, 1, 4);
     if ($resolverStyle == ResolverStyle::LENIENT()) {
         $dow = $dowLong;
         // unvalidated
         if ($dow > 7) {
             $date = $date->plusWeeks(Math::div($dow - 1, 7));
             $dow = ($dow - 1) % 7 + 1;
         } else {
             if ($dow < 1) {
                 $date = $date->plusWeeks(Math::div(Math::subtractExact($dow, 7), 7));
                 $dow = ($dow + 6) % 7 + 1;
             }
         }
         $date = $date->plusWeeks(Math::subtractExact($wowby, 1))->with(ChronoField::DAY_OF_WEEK(), $dow);
     } else {
         $dow = ChronoField::DAY_OF_WEEK()->checkValidIntValue($dowLong);
         // validated
         if ($wowby < 1 || $wowby > 52) {
             if ($resolverStyle == ResolverStyle::STRICT()) {
                 IsoFields::getWeekRange($date)->checkValidValue($wowby, $this);
                 // only allow exact range
             } else {
                 // SMART
                 $this->range()->checkValidValue($wowby, $this);
                 // allow 1-53 rolling into next year
             }
         }
         $date = $date->plusWeeks($wowby - 1)->with(ChronoField::DAY_OF_WEEK(), $dow);
     }
     $fieldValues->remove($this);
     $fieldValues->remove(IsoFields::WEEK_BASED_YEAR());
     $fieldValues->remove(ChronoField::DAY_OF_WEEK());
     return $date;
 }
예제 #23
0
 /**
  * Adjusts the specified temporal object to have this day-of-week.
  * <p>
  * This returns a temporal object of the same observable type as the input
  * with the day-of-week changed to be the same as this.
  * <p>
  * The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}
  * passing {@link ChronoField#DAY_OF_WEEK} as the field.
  * Note that this adjusts forwards or backwards within a Monday to Sunday week.
  * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days.
  * See {@code TemporalAdjuster} for other adjusters with more control,
  * such as {@code next(MONDAY)}.
  * <p>
  * In most cases, it is clearer to reverse the calling pattern by using
  * {@link Temporal#with(TemporalAdjuster)}:
  * <pre>
  *   // these two lines are equivalent, but the second approach is recommended
  *   temporal = thisDayOfWeek.adjustInto(temporal);
  *   temporal = temporal.with(thisDayOfWeek);
  * </pre>
  * <p>
  * For example, given a date that is a Wednesday, the following are output:
  * <pre>
  *   dateOnWed.with(MONDAY);     // two days earlier
  *   dateOnWed.with(TUESDAY);    // one day earlier
  *   dateOnWed.with(WEDNESDAY);  // same date
  *   dateOnWed.with(THURSDAY);   // one day later
  *   dateOnWed.with(FRIDAY);     // two days later
  *   dateOnWed.with(SATURDAY);   // three days later
  *   dateOnWed.with(SUNDAY);     // four days later
  * </pre>
  * <p>
  * This instance is immutable and unaffected by this method call.
  *
  * @param Temporal $temporal the target object to be adjusted, not null
  * @return Temporal the adjusted object, not null
  * @throws DateTimeException if unable to make the adjustment
  * @throws ArithmeticException if numeric overflow occurs
  */
 public function adjustInto(Temporal $temporal)
 {
     return $temporal->with(ChronoField::DAY_OF_WEEK(), $this->getValue());
 }
예제 #24
0
 public function test_getLong_TemporalField()
 {
     $test = LocalDateTime::of(2008, 6, 30, 12, 30, 40, 987654321);
     $this->assertEquals($test->getLong(CF::YEAR()), 2008);
     $this->assertEquals($test->getLong(CF::MONTH_OF_YEAR()), 6);
     $this->assertEquals($test->getLong(CF::DAY_OF_MONTH()), 30);
     $this->assertEquals($test->getLong(CF::DAY_OF_WEEK()), 1);
     $this->assertEquals($test->getLong(CF::DAY_OF_YEAR()), 182);
     $this->assertEquals($test->getLong(CF::HOUR_OF_DAY()), 12);
     $this->assertEquals($test->getLong(CF::MINUTE_OF_HOUR()), 30);
     $this->assertEquals($test->getLong(CF::SECOND_OF_MINUTE()), 40);
     $this->assertEquals($test->getLong(CF::NANO_OF_SECOND()), 987654321);
     $this->assertEquals($test->getLong(CF::HOUR_OF_AMPM()), 0);
     $this->assertEquals($test->getLong(CF::AMPM_OF_DAY()), 1);
 }
예제 #25
0
 /**
  * @dataProvider data_weekFields
  */
 public function test_parse_resolve_localizedWoWBY_strict(DayOfWeek $firstDayOfWeek, $minDays)
 {
     $week = WeekFields::of($firstDayOfWeek, $minDays);
     $wowbyField = $week->weekOfWeekBasedYear();
     $yowbyField = $week->weekBasedYear();
     $f = (new DateTimeFormatterBuilder())->appendValue($yowbyField)->appendLiteral(':')->appendValue($wowbyField)->appendLiteral(':')->appendValue(CF::DAY_OF_WEEK())->toFormatter()->withResolverStyle(ResolverStyle::STRICT());
     $str = "2012:0:1";
     try {
         $date = LocalDate::parseWith($str, $f);
         $this->assertEquals($date->get($yowbyField), 2012);
         $this->assertEquals($date->get($wowbyField), 0);
         $this->assertEquals($date->get(CF::DAY_OF_WEEK()), 1);
     } catch (DateTimeException $ex) {
         // expected
     }
 }
예제 #26
0
 /**
  * Returns a copy of this date with the specified field set to a new value.
  * <p>
  * This returns a {@code LocalDate}, based on this one, with the value
  * for the specified field changed.
  * This can be used to change any supported field, such as the year, month or day-of-month.
  * 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>
  * In some cases, changing the specified field can cause the resulting date to become invalid,
  * such as changing the month from 31st January to February would make the day-of-month invalid.
  * In cases like this, the field is responsible for resolving the date. Typically it will choose
  * the previous valid date, which would be the last valid day of February in this example.
  * <p>
  * If the field is a {@link ChronoField} then the adjustment is implemented here.
  * The supported fields behave as follows:
  * <ul>
  * <li>{@code DAY_OF_WEEK} -
  *  Returns a {@code LocalDate} with the specified day-of-week.
  *  The date is adjusted up to 6 days forward or backward within the boundary
  *  of a Monday to Sunday week.
  * <li>{@code ALIGNED_DAY_OF_WEEK_IN_MONTH} -
  *  Returns a {@code LocalDate} with the specified aligned-day-of-week.
  *  The date is adjusted to the specified month-based aligned-day-of-week.
  *  Aligned weeks are counted such that the first week of a given month starts
  *  on the first day of that month.
  *  This may cause the date to be moved up to 6 days into the following month.
  * <li>{@code ALIGNED_DAY_OF_WEEK_IN_YEAR} -
  *  Returns a {@code LocalDate} with the specified aligned-day-of-week.
  *  The date is adjusted to the specified year-based aligned-day-of-week.
  *  Aligned weeks are counted such that the first week of a given year starts
  *  on the first day of that year.
  *  This may cause the date to be moved up to 6 days into the following year.
  * <li>{@code DAY_OF_MONTH} -
  *  Returns a {@code LocalDate} with the specified day-of-month.
  *  The month and year will be unchanged. If the day-of-month is invalid for the
  *  year and month, then a {@code DateTimeException} is thrown.
  * <li>{@code DAY_OF_YEAR} -
  *  Returns a {@code LocalDate} with the specified day-of-year.
  *  The year will be unchanged. If the day-of-year is invalid for the
  *  year, then a {@code DateTimeException} is thrown.
  * <li>{@code EPOCH_DAY} -
  *  Returns a {@code LocalDate} with the specified epoch-day.
  *  This completely replaces the date and is equivalent to {@link #ofEpochDay(long)}.
  * <li>{@code ALIGNED_WEEK_OF_MONTH} -
  *  Returns a {@code LocalDate} with the specified aligned-week-of-month.
  *  Aligned weeks are counted such that the first week of a given month starts
  *  on the first day of that month.
  *  This adjustment moves the date in whole week chunks to match the specified week.
  *  The result will have the same day-of-week as this date.
  *  This may cause the date to be moved into the following month.
  * <li>{@code ALIGNED_WEEK_OF_YEAR} -
  *  Returns a {@code LocalDate} with the specified aligned-week-of-year.
  *  Aligned weeks are counted such that the first week of a given year starts
  *  on the first day of that year.
  *  This adjustment moves the date in whole week chunks to match the specified week.
  *  The result will have the same day-of-week as this date.
  *  This may cause the date to be moved into the following year.
  * <li>{@code MONTH_OF_YEAR} -
  *  Returns a {@code LocalDate} with the specified month-of-year.
  *  The year will be unchanged. The day-of-month will also be unchanged,
  *  unless it would be invalid for the new month and year. In that case, the
  *  day-of-month is adjusted to the maximum valid value for the new month and year.
  * <li>{@code PROLEPTIC_MONTH} -
  *  Returns a {@code LocalDate} with the specified proleptic-month.
  *  The day-of-month will be unchanged, unless it would be invalid for the new month
  *  and year. In that case, the day-of-month is adjusted to the maximum valid value
  *  for the new month and year.
  * <li>{@code YEAR_OF_ERA} -
  *  Returns a {@code LocalDate} with the specified year-of-era.
  *  The era and month will be unchanged. The day-of-month will also be unchanged,
  *  unless it would be invalid for the new month and year. In that case, the
  *  day-of-month is adjusted to the maximum valid value for the new month and year.
  * <li>{@code YEAR} -
  *  Returns a {@code LocalDate} with the specified year.
  *  The month will be unchanged. The day-of-month will also be unchanged,
  *  unless it would be invalid for the new month and year. In that case, the
  *  day-of-month is adjusted to the maximum valid value for the new month and year.
  * <li>{@code ERA} -
  *  Returns a {@code LocalDate} with the specified era.
  *  The year-of-era and month will be unchanged. The day-of-month will also be unchanged,
  *  unless it would be invalid for the new month and year. In that case, the
  *  day-of-month is adjusted to the maximum valid value for the new month and year.
  * </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 LocalDate a {@code LocalDate} 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) {
         /** @var Chronofield $f */
         $f = $field;
         $f->checkValidValue($newValue);
         switch ($f) {
             case ChronoField::DAY_OF_WEEK():
                 return $this->plusDays($newValue - $this->getDayOfWeek()->getValue());
             case ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH():
                 return $this->plusDays($newValue - $this->getLong(ChronoField::ALIGNED_DAY_OF_WEEK_IN_MONTH()));
             case ChronoField::ALIGNED_DAY_OF_WEEK_IN_YEAR():
                 return $this->plusDays($newValue - $this->getLong(ChronoField::ALIGNED_DAY_OF_WEEK_IN_YEAR()));
             case ChronoField::DAY_OF_MONTH():
                 return $this->withDayOfMonth((int) $newValue);
             case ChronoField::DAY_OF_YEAR():
                 return $this->withDayOfYear((int) $newValue);
             case ChronoField::EPOCH_DAY():
                 return LocalDate::ofEpochDay($newValue);
             case ChronoField::ALIGNED_WEEK_OF_MONTH():
                 return $this->plusWeeks($newValue - $this->getLong(ChronoField::ALIGNED_WEEK_OF_MONTH()));
             case ChronoField::ALIGNED_WEEK_OF_YEAR():
                 return $this->plusWeeks($newValue - $this->getLong(ChronoField::ALIGNED_WEEK_OF_YEAR()));
             case ChronoField::MONTH_OF_YEAR():
                 return $this->withMonth((int) $newValue);
             case ChronoField::PROLEPTIC_MONTH():
                 return $this->plusMonths($newValue - $this->getProlepticMonth());
             case ChronoField::YEAR_OF_ERA():
                 return $this->withYear((int) ($this->year >= 1 ? $newValue : 1 - $newValue));
             case ChronoField::YEAR():
                 return $this->withYear((int) $newValue);
             case ChronoField::ERA():
                 return $this->getLong(ChronoField::ERA()) == $newValue ? $this : $this->withYear(1 - $this->year);
         }
         throw new UnsupportedTemporalTypeException("Unsupported field: " . $field);
     }
     return $field->adjustInto($this, $newValue);
 }
예제 #27
0
 function provider_StandaloneNames()
 {
     return [[self::RUSSIAN(), ChronoField::MONTH_OF_YEAR(), TextStyle::FULL_STANDALONE(), TestHelper::getRussianJanuary()], [self::RUSSIAN(), ChronoField::MONTH_OF_YEAR(), TextStyle::SHORT_STANDALONE(), TestHelper::getRussianJan()], [self::FINNISH(), ChronoField::DAY_OF_WEEK(), TextStyle::FULL_STANDALONE(), "tiistai"], [self::FINNISH(), ChronoField::DAY_OF_WEEK(), TextStyle::SHORT_STANDALONE(), "ti"]];
 }
 public function data_text()
 {
     return [[ChronoField::DAY_OF_WEEK(), 1, TextStyle::SHORT(), self::enUS(), "Mon"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::SHORT(), self::enUS(), "Tue"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::SHORT(), self::enUS(), "Wed"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::SHORT(), self::enUS(), "Thu"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::SHORT(), self::enUS(), "Fri"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::SHORT(), self::enUS(), "Sat"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::SHORT(), self::enUS(), "Sun"], [ChronoField::DAY_OF_WEEK(), 1, TextStyle::SHORT(), self::ptBR(), "seg"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::SHORT(), self::ptBR(), "ter"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::SHORT(), self::ptBR(), "qua"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::SHORT(), self::ptBR(), "qui"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::SHORT(), self::ptBR(), "sex"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::SHORT(), self::ptBR(), "sáb"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::SHORT(), self::ptBR(), "dom"], [ChronoField::DAY_OF_WEEK(), 1, TextStyle::FULL(), self::enUS(), "Monday"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::FULL(), self::enUS(), "Tuesday"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::FULL(), self::enUS(), "Wednesday"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::FULL(), self::enUS(), "Thursday"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::FULL(), self::enUS(), "Friday"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::FULL(), self::enUS(), "Saturday"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::FULL(), self::enUS(), "Sunday"], [ChronoField::DAY_OF_WEEK(), 1, TextStyle::FULL(), self::ptBR(), "segunda-feira"], [ChronoField::DAY_OF_WEEK(), 2, TextStyle::FULL(), self::ptBR(), "terça-feira"], [ChronoField::DAY_OF_WEEK(), 3, TextStyle::FULL(), self::ptBR(), "quarta-feira"], [ChronoField::DAY_OF_WEEK(), 4, TextStyle::FULL(), self::ptBR(), "quinta-feira"], [ChronoField::DAY_OF_WEEK(), 5, TextStyle::FULL(), self::ptBR(), "sexta-feira"], [ChronoField::DAY_OF_WEEK(), 6, TextStyle::FULL(), self::ptBR(), "sábado"], [ChronoField::DAY_OF_WEEK(), 7, TextStyle::FULL(), self::ptBR(), "domingo"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::SHORT(), self::enUS(), "Jan"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::SHORT(), self::enUS(), "Feb"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::SHORT(), self::enUS(), "Mar"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::SHORT(), self::enUS(), "Apr"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::SHORT(), self::enUS(), "May"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::SHORT(), self::enUS(), "Jun"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::SHORT(), self::enUS(), "Jul"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::SHORT(), self::enUS(), "Aug"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::SHORT(), self::enUS(), "Sep"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::SHORT(), self::enUS(), "Oct"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::SHORT(), self::enUS(), "Nov"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::SHORT(), self::enUS(), "Dec"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::SHORT(), self::ptBR(), "jan"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::SHORT(), self::ptBR(), "fev"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::SHORT(), self::ptBR(), "mar"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::SHORT(), self::ptBR(), "abr"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::SHORT(), self::ptBR(), "mai"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::SHORT(), self::ptBR(), "jun"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::SHORT(), self::ptBR(), "jul"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::SHORT(), self::ptBR(), "ago"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::SHORT(), self::ptBR(), "set"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::SHORT(), self::ptBR(), "out"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::SHORT(), self::ptBR(), "nov"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::SHORT(), self::ptBR(), "dez"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::FULL(), self::enUS(), "January"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::FULL(), self::enUS(), "February"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::FULL(), self::enUS(), "March"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::FULL(), self::enUS(), "April"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::FULL(), self::enUS(), "May"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::FULL(), self::enUS(), "June"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::FULL(), self::enUS(), "July"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::FULL(), self::enUS(), "August"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::FULL(), self::enUS(), "September"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::FULL(), self::enUS(), "October"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::FULL(), self::enUS(), "November"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::FULL(), self::enUS(), "December"], [ChronoField::MONTH_OF_YEAR(), 1, TextStyle::FULL(), self::ptBR(), "janeiro"], [ChronoField::MONTH_OF_YEAR(), 2, TextStyle::FULL(), self::ptBR(), "fevereiro"], [ChronoField::MONTH_OF_YEAR(), 3, TextStyle::FULL(), self::ptBR(), "março"], [ChronoField::MONTH_OF_YEAR(), 4, TextStyle::FULL(), self::ptBR(), "abril"], [ChronoField::MONTH_OF_YEAR(), 5, TextStyle::FULL(), self::ptBR(), "maio"], [ChronoField::MONTH_OF_YEAR(), 6, TextStyle::FULL(), self::ptBR(), "junho"], [ChronoField::MONTH_OF_YEAR(), 7, TextStyle::FULL(), self::ptBR(), "julho"], [ChronoField::MONTH_OF_YEAR(), 8, TextStyle::FULL(), self::ptBR(), "agosto"], [ChronoField::MONTH_OF_YEAR(), 9, TextStyle::FULL(), self::ptBR(), "setembro"], [ChronoField::MONTH_OF_YEAR(), 10, TextStyle::FULL(), self::ptBR(), "outubro"], [ChronoField::MONTH_OF_YEAR(), 11, TextStyle::FULL(), self::ptBR(), "novembro"], [ChronoField::MONTH_OF_YEAR(), 12, TextStyle::FULL(), self::ptBR(), "dezembro"], [ChronoField::AMPM_OF_DAY(), 0, TextStyle::SHORT(), self::enUS(), "AM"], [ChronoField::AMPM_OF_DAY(), 1, TextStyle::SHORT(), self::enUS(), "PM"]];
 }
 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()];
 }