Active
Project:
Material Admin
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Apr 2018 at 17:39 UTC
Updated:
26 Aug 2018 at 20:05 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
Bcwald commentedYeah - So that was something I wanted to set an option for - but unless it fixed in materializecss - I would need to move to a differnet time picker.
The issue is that time picker in materializecss requires the format type="text" where Drupal sets that to "date".
you can see the issue here: https://github.com/Dogfalo/materialize/pull/4882#issuecomment-310851766
Comment #3
attheshow commentedI noticed in the docs they mention an option in the Time Picker for "twelveHour Boolean true Use 12 hour AM/PM clock instead of 24 hour clock." Would that be an option?
Comment #4
Bcwald commentedCorrect, setting that works OK in the picker itself - however its the inputSubmit format that doesn't get set correctly for type=date. (see gif)
It may be possible to do a function to convert that in the "after select" function.
Comment #5
Bcwald commentedAnother option would be to use a custom twig template for the time field when 12 hour is selected - which we could change the type to "text", however that could break validation and potentially cause a security risk? Im not sure.
Comment #6
attheshow commentedThat would be great if we could convert it to match what Drupal is expecting in the way of formatting and use the built-in AM/PM selection. Seems like an ideal solution.
Comment #7
attheshow commentedHere's a patch to get this working. This doesn't include the options screen selection that you mentioned and it required that I modify the old 2014 pickadate.js that's included inside this version of materialize.js but this is working well. I'm basically reformatting the selected value into the 24 hour format that Drupal fields are expecting.
Comment #8
attheshow commentedSorry for the empty patch file! Here it is.
Comment #9
attheshow commentedUpdates patch to fix issue with inability to select 12:00 PM.
Comment #10
attheshow commentedUpdates patch to fix issue with inability to select 12:00 AM times.