public function test_pattern_String()
 {
     $test = DateTimeFormatter::ofPattern("d MMM yyyy");
     $fmtLocale = Locale::getDefault();
     $this->assertEquals($test->format(LocalDate::of(2012, 6, 30)), "30 " . Month::JUNE()->getDisplayName(TextStyle::SHORT(), $fmtLocale) . " 2012");
     $this->assertEquals($test->getLocale(), $fmtLocale, "Locale.Category.FORMAT");
 }
Example #2
0
 /**
  * Obtains the DecimalStyle for the default
  * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
  * <p>
  * This method provides access to locale sensitive decimal style symbols.
  * <p>
  * This is equivalent to calling
  * {@link #of(Locale)
  *     of(Locale.getDefault(Locale.Category.FORMAT))}.
  *
  * @see java.util.Locale.Category#FORMAT
  * @return DecimalStyle the decimal style, not null
  */
 public static function ofDefaultLocale()
 {
     return self::of(Locale::getDefault());
 }
 /**
  * Completes this builder by creating the formatter.
  * This uses the default locale.
  *
  * @param ResolverStyle $resolverStyle the resolver style to use, not null
  * @return DateTimeFormatter the created formatter, not null
  */
 public function toFormatter3(ResolverStyle $resolverStyle, $chrono)
 {
     // TODO fix Locale use
     return $this->toFormatter4(Locale::getDefault(), $resolverStyle, $chrono);
 }