Force date/time preferences to valid values
Fixes T8601. To reproduce the problem:
- Set your time preference to "" (the empty string). This isn't possible from the modern UI, but can be done with "Right Click > Inspect Element", or users may have carried it forward from an older setting (this is the case with me and @hach-que on this install).
- Load Calendar with some events.
- This parses an epoch, which sets valueTime to "" (since there are no format characters in the preference) and then getEpoch() fails because strlen($time) is 0.
- Since getEpoch() failed, getDateTime() also fails.
To fix this:
- Only permit the date and time preferences to have valid values.
- Loaded page before patch, saw fatal.
- Applied patch.
- No more fatal.
- Viewed tooltips, dates/times, dates/times in other apps.
- Changed my preferences, saw them respected.
Reviewed By: lpriestley
Subscribers: epriestley, hach-que
Maniphest Tasks: T8601
Differential Revision: https://secure.phabricator.com/D13346