public function format(DateTimePrintContext $context, &$buf) { $value = $context->getValueField($this->field); if ($value === null) { return false; } $text = null; $chrono = $context->getTemporal()->query(TemporalQueries::chronology()); if ($chrono === null || $chrono == IsoChronology::INSTANCE()) { $text = $this->provider->getText($this->field, $value, $this->textStyle, $context->getLocale()); } else { $text = $this->provider->getText2($chrono, $this->field, $value, $this->textStyle, $context->getLocale()); } if ($text === null) { return $this->numberPrinterParser()->format($context, $buf); } $buf .= $text; return true; }
public function format(DateTimePrintContext $context, &$buf) { $chrono = $context->getValue(TemporalQueries::chronology()); if ($chrono == null) { return false; } if ($this->textStyle == null) { $buf .= $chrono->getId(); } else { $buf .= $this->getChronologyName($chrono, $context->getLocale()); } return true; }
public function format(DateTimePrintContext $context, &$buf) { /** @var ZoneID $zone */ $zone = $context->getValue(TemporalQueries::zoneId()); if ($zone === null) { return false; } $zname = $zone->getId(); if (!$zone instanceof ZoneOffset) { $dt = $context->getTemporal(); $name = $this->getDisplayName($zname, $dt->isSupported(ChronoField::INSTANT_SECONDS()) ? $zone->getRules()->isDaylightSavings(Instant::from($dt)) ? self::$DST : self::$STD : self::$GENERIC, $context->getLocale()); if ($name !== null) { $zname = $name; } } $buf .= $zname; return true; }