@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow standard date fields to read default dates as strings

Summary: Ref T2217. Fixes T3866. We need to do a little more massaging before we can set strings as the value on datetime controls.

Test Plan: Set default to "1:23 AM", "2001/02/03".

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2217, T3866

Differential Revision: https://secure.phabricator.com/D7116

+12 -1
+12 -1
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
··· 65 65 ->setCaption($this->getCaption()) 66 66 ->setAllowNull(!$this->getRequired()); 67 67 68 - $control->setValue($this->getFieldValue()); 68 + // If the value is already numeric, treat it as an epoch timestamp and set 69 + // it directly. Otherwise, it's likely a field default, which we let users 70 + // specify as a string. Parse the string into an epoch. 71 + 72 + $value = $this->getFieldValue(); 73 + if (!ctype_digit($value)) { 74 + $value = PhabricatorTime::parseLocalTime($value, $this->getViewer()); 75 + } 76 + 77 + // If we don't have anything valid, make sure we pass `null`, since the 78 + // control special-cases that. 79 + $control->setValue(nonempty($value, null)); 69 80 70 81 return $control; 71 82 }