1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +02:00

Fix issue processwire/processwire-issues#758 unable to select "17:10:02" time format in FieldtypeDatetime

This commit is contained in:
Ryan Cramer
2018-11-30 13:42:15 -05:00
parent 65b3edb761
commit 0442572885

View File

@@ -288,13 +288,13 @@ class FieldtypeDatetime extends FieldtypeText {
$f->addOption('', $this->_('None'));
$f->columnWidth = 50;
$date = strtotime('5:10:02 PM');
$found = false;
$dateOutputFormat = $field->get('dateOutputFormat');
foreach($wdt->getTimeFormats() as $format) {
$timeFormatted = $wdt->formatDate($date, $format);
$f->addOption($format, $timeFormatted);
if(!$found && strpos($field->get('dateOutputFormat'), $format) !== false) {
$f->attr('value', $format);
$found = true;
if(strpos($dateOutputFormat, $format) !== false) {
list(,$test) = explode($format, $dateOutputFormat);
if(!strlen($test)) $f->attr('value', $format);
}
}
$f->attr('onchange', "$('#Inputfield_dateOutputFormat').val($('#Inputfield__dateOutputFormat').val() + ' ' + $(this).val());");