GWT Time Picker?

后端 未结 8 1753
青春惊慌失措
青春惊慌失措 2020-12-13 07:19

Does anyone know if in GWT we have a good TimePicker ? In fact I want a widget in order to select hour and minute for GWT.

Thanks

相关标签:
8条回答
  • 2020-12-13 08:10

    AFAIK there's no such a widget. Also "a good TimePicker" is a bit suggestive. I've been looking for such a widget for a long time and I found some javascript examples that were completely awful, but some people is using.

    Finally I decided to do my own, based in a TextBox with value control.

    alt text

    The source code is available, you can find more info here and on github I hope you like it.

    I have seen some TimePicker that are simple ComboBoxes.

    0 讨论(0)
  • 2020-12-13 08:12

    I wrote a Time Picker recently. I wrote it in a hurry, so it's not the best out there, but it works fine.

    It attempts to create a HTML5 <input type="time"/> and if it's not supported by the browser, it parses manually. I have tested it on Chrome and Firefox on PC, and iOS.

    Accepted formats are:

    • 12:59 AM
    • 5 - assumed to be 5 AM
    • 5p - 5:00 PM
    • 13 - 1 PM
    • 345 - 3:45 AM
    • 1534 - 3:34 PM
    • 111p - 1:11 PM

    it implements HasValue<Long> to return the picked time as milliseconds. It also has a method to return the time combined with a given Date object.

    Here's the source: https://github.com/srilankanchurro/gwt-stuff/blob/master/gwt-stuff/src/com/sathkumara/client/TimePicker.java

    If you have modifications to contribute to this class, please feel free to send me a request on github.

    0 讨论(0)
提交回复
热议问题