diff --git a/src/view/form/control/AphrontFormDateControlValue.php b/src/view/form/control/AphrontFormDateControlValue.php --- a/src/view/form/control/AphrontFormDateControlValue.php +++ b/src/view/form/control/AphrontFormDateControlValue.php @@ -169,7 +169,8 @@ return phabricator_format_local_time( $epoch, $this->viewer, - $format); + $format, + false); // Don't translate the date, to allow us to reparse it later } public function getEpoch() { diff --git a/src/view/viewutils.php b/src/view/viewutils.php --- a/src/view/viewutils.php +++ b/src/view/viewutils.php @@ -107,9 +107,12 @@ * @param int $epoch Unix epoch timestamp. * @param PhabricatorUser $user User viewing the timestamp. * @param string $format Date format, as per DateTime class. + * @param bool $translate (optional) Whether to translate individual date + * elements. If set to false, will leave them in English, but + * still apply the user's timezone preferences. * @return string Formatted, local date/time. */ -function phabricator_format_local_time($epoch, $user, $format) { +function phabricator_format_local_time($epoch, $user, $format, $translate = true) { if (!$epoch) { // If we're missing date information for something, the DateTime class will // throw an exception when we try to construct an object. Since this is a @@ -140,6 +143,9 @@ } $date->setTimezone($zone); - - return PhutilTranslator::getInstance()->translateDate($format, $date); + if ($translate) { + return PhutilTranslator::getInstance()->translateDate($format, $date); + } else { + return $date->format($format); + } }