From 04425728853fbebd1e8f21f31630063c2182d16d Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 30 Nov 2018 13:42:15 -0500 Subject: [PATCH] Fix issue processwire/processwire-issues#758 unable to select "17:10:02" time format in FieldtypeDatetime --- wire/modules/Fieldtype/FieldtypeDatetime.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wire/modules/Fieldtype/FieldtypeDatetime.module b/wire/modules/Fieldtype/FieldtypeDatetime.module index 7d91efa7..99f9361b 100644 --- a/wire/modules/Fieldtype/FieldtypeDatetime.module +++ b/wire/modules/Fieldtype/FieldtypeDatetime.module @@ -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());");