mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 10:41:08 +01:00
Support colloquial time names to dramatically improve usability of time control
Summary: Ref T8024. The time control currently does not support colloquial time names frequently used in common parlance. Support these times. Test Plan: Easily specified many of the most important times in a convenient way. Reviewers: btrahan, chad, lpriestley Reviewed By: lpriestley Subscribers: johnny-bit, eadler, epriestley Maniphest Tasks: T8024 Differential Revision: https://secure.phabricator.com/D12674
This commit is contained in:
parent
948d69364a
commit
3ea7359e16
1 changed files with 16 additions and 0 deletions
|
@ -179,6 +179,22 @@ final class AphrontFormDateControlValue extends Phobject {
|
|||
return null;
|
||||
}
|
||||
|
||||
$colloquial = array(
|
||||
'elevenses' => '11:00 AM',
|
||||
'morning tea' => '11:00 AM',
|
||||
'noon' => '12:00 PM',
|
||||
'high noon' => '12:00 PM',
|
||||
'lunch' => '12:00 PM',
|
||||
'tea time' => '3:00 PM',
|
||||
'witching hour' => '12:00 AM',
|
||||
'midnight' => '12:00 AM',
|
||||
);
|
||||
|
||||
$normalized = phutil_utf8_strtolower($time);
|
||||
if (isset($colloquial[$normalized])) {
|
||||
$time = $colloquial[$normalized];
|
||||
}
|
||||
|
||||
try {
|
||||
$date = new DateTime("{$year}-{$month}-{$day} {$time}", $zone);
|
||||
$value = $date->format('U');
|
||||
|
|
Loading…
Reference in a new issue