1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 18:51:12 +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:
epriestley 2015-05-04 10:09:15 -07:00
parent 948d69364a
commit 3ea7359e16

View file

@ -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');