XUL:Specs:DateTimePickers

From MozillaWiki
Revision as of 16:29, 14 July 2006 by Enn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Requirements

  • Need widgets for selecting or entering dates and times
  • Should support 12 or 24 hour clocks
  • Should display times and dates in a localized manner

Time Picker

A widget for selecting times. It contains a textbox with a spinbuttons next to it. The textbox is actually three textboxes inside of a box styled to look like a textbox. The three textboxes allow entry of an hour, minute and second. The spinbuttons adjusts the value of the currently focused textbox. A fourth textbox appears for 12 hour clocks which allows selection of AM or PM.


<timepicker value=""
               increment="10"
               hideseconds="false">
hideseconds
set to true to hide the seconds entry field.
increment
the granularity of minutes that may be selected. For instance, 5 means that only minutes divisible by 5 may be selected. Pressing the spinbuttons while the minute field is focused will increment or decrement the minutes by this value.
value
the default time to be set for the timepicker. The syntax is 'hh:mm:ss'.

Properties:

value
the current value selected in the timepicker as a Date object.
hour
the currently selected hour from 0 to 23.
minute
the currently selected minute from 0 to 59.
second
the currently selected second from 0 to 59.
isPM
true if the hour is between 12 and 23.
hideseconds
set to true to hide the seconds entry field.

increment : gets and sets the value of the increment attribute.

All of the properties above may be modified to change the current time.

Methods:

decrease: decrease the currently focused field by 1. increase: increase the currently focused field by 1.