简体   繁体   English

Bootstrap DateTimePicker将时间设置为午夜

[英]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 ). 我正在使用gwtbootstrap3( https://github.com/gwtbootstrap3/gwtbootstrap3 ),其中包含了针对smalot的datetimepicker( https://github.com/smalot/bootstrap-datetimepicker )的GWT包装器。

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. 问题是:每当我选择12:00时,datetimepicker.getValue()都会返回一个日期,其中包含正确的年,月和日但是00:00。

Everything else works just fine, so if I select 13:00 it returns 13:00 and so on. 其他一切都很好,所以如果我选择13:00它会返回13:00,依此类推。 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. 我认为这是原始javascript库中的一个错误或gwtbootstrap3中使用的版本,但无法弄清楚什么是错误的,因为我真的不知道如何调试JS文件。

I configure the datetimepicker as follows (GWT UIBinder): 我按如下方式配置datetimepicker(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. 我查看了DateTime Picker网站。 I'm not sure if it would make a difference but, try 我不确定它是否有所作为但是,试试吧

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

Perhaps the uppercase 'HH' caused problems. 也许大写的'HH'引起了问题。

Edit: I see now that 'HH' is 12 hour while, 'hh' is 24 hour. 编辑:我现在看到'HH'是12小时,'hh'是24小时。 I still believe that it would be the problem though. 我仍然认为这会是问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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