Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2865851
D25861.1736611762.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25861.1736611762.diff
View Options
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,14 @@
* @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 +145,9 @@
}
$date->setTimezone($zone);
-
- return PhutilTranslator::getInstance()->translateDate($format, $date);
+ if ($translate) {
+ return PhutilTranslator::getInstance()->translateDate($format, $date);
+ } else {
+ return $date->format($format);
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 16:09 (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1110650
Default Alt Text
D25861.1736611762.diff (1 KB)
Attached To
Mode
D25861: Don't try to translate date elements used internally in AphrontFormDateControlValue
Attached
Detach File
Event Timeline
Log In to Comment