File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -182,16 +182,18 @@ public function scaffoldFormField($title = null, $params = null)
182182 $ dateTimeFormat = $ field ->getDatetimeFormat ();
183183 $ locale = $ field ->getLocale ();
184184
185- // Set date formatting hints and example
186- $ date = static ::now ()->Format ($ dateTimeFormat , $ locale );
187- $ field
188- ->setDescription (_t (
185+ // Set date formatting hints and example when not using HTML5 inputs,
186+ // as browsers handle format display natively for HTML5 datetime-local fields
187+ $ field ->setAttribute ('placeholder ' , $ dateTimeFormat );
188+ if (!$ field ->getHTML5 ()) {
189+ $ date = static ::now ()->Format ($ dateTimeFormat , $ locale );
190+ $ field ->setDescription (_t (
189191 'SilverStripe \\Forms \\FormField.EXAMPLE ' ,
190192 'e.g. {format} ' ,
191193 'Example format ' ,
192194 ['format ' => $ date ]
193- ))
194- -> setAttribute ( ' placeholder ' , $ dateTimeFormat );
195+ ));
196+ }
195197
196198 return $ field ;
197199 }
You can’t perform that action at this time.
0 commit comments