简体   繁体   中英

Bootstrap DateTimePicker sets time to midnight

I am using a gwtbootstrap3 ( https://github.com/gwtbootstrap3/gwtbootstrap3 ) which includes a GWT wrapper for smalot's datetimepicker ( https://github.com/smalot/bootstrap-datetimepicker ).

The problem is: Whenever I select 12:00, the datetimepicker.getValue() returns a date with the correct year, month and day but with 00:00.

Everything else works just fine, so if I select 13:00 it returns 13:00 and so on. I assume this is a bug in the original javascript library or the version used in gwtbootstrap3 but can't figure out whats wrong as I don't really know how to debug the JS file.

I configure the datetimepicker as follows (GWT UIBinder):

<bDateTime:DateTimePicker ui:field="startDateTimePicker" forceParse="false" autoClose="true" startView="MONTH" minView="HOUR" maxView="MONTH" language="DE" format="dd.mm.yyyy HH:ii" minuteStep="60" highlightToday="true" showTodayButton="false"/>

Does anyone have any idea what could cause this problem and how to solve it?

I looked at the DateTime Picker website. I'm not sure if it would make a difference but, try

format="dd.mm.yyyy hh:ii"

Perhaps the uppercase 'HH' caused problems.

Edit: I see now that 'HH' is 12 hour while, 'hh' is 24 hour. I still believe that it would be the problem though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM