jtsage / jtsage-datebox

A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
http://datebox.jtsage.dev/
Other
474 stars 166 forks source link

Time not initializing #237

Closed czuck closed 11 years ago

czuck commented 12 years ago

Using the code: input name="StartTime" id="StartTime" type="date" data-role="datebox" data-options='{"mode": "timeflipbox", "useFocus": true, "centerHoriz":true, "themeHeader":"b", "themeDatePick":"b"}' value="@Model.StartTime.ToShortTimeString()"

if the hours of the StartTime contains only one digit, the time will not pre-populate when the datebox is opened. It does display in the date dialog correctly. If the StartTime contains a 2-digit hour, then it works.

jtsage commented 11 years ago

You can make this work if you set the time output format to not zero-pad as well. %-I:%M %p (12hr) or %-H:%M (24hr) - the option for that is overrideTimeOutput

czuck commented 11 years ago

I'm still having an issue with this. If I change the code to: data-options='{"mode": "timeflipbox", "useFocus": true, "centerHoriz":true, "themeHeader":"b", "themeDatePick":"b", "overrideTimeOutput":" %-I:%M"}' then when I open the datebox the time is the current time, not the time it was set to, regardless of the number if digits. If I change it to this: data-options='{"mode": "timeflipbox", "useFocus": true, "centerHoriz":true, "themeHeader":"b", "themeDatePick":"b", "timeOutput":" %-I:%M"}' then it works as I described before, where the leading 0 is required. I am using a 12 hr clock.
Can you see my error or point me to an example that works?

jtsage commented 11 years ago

the only error I see in what you pasted is a lack of %p or %P (no way to tell AM/PM or am/pm). Here is a working example, with a time in the value="" field in the source.

http://dev.jtsage.com/jQM-DateBox2/tests/time-exp.html

czuck commented 11 years ago

Thanks, that did it!