Clear Up
SharpKit Reference

Time Class

Provides a time input field with a time dropdown and automatic time validation.

This field recognizes and uses JavaScript Date objects as its main value type (only the time portion of the date is used; the month/day/year are ignored). In addition, it recognizes string values which are parsed according to the format and/or altFormats configs. These may be reconfigured to use time formats appropriate for the user's locale.

The field may be limited to a certain range of times by using the minValue and maxValue configs, and the interval between time options in the dropdown can be changed with the increment config.

Example usage:

  
    Ext.create('Ext.form.Panel', {
            title: 'Time Card',
            width: 300,
            bodyPadding: 10,
            renderTo: Ext.getBody(),
            items: [{
            xtype: 'timefield',
            name: 'in',
            fieldLabel: 'Time In',
            minValue: '6:00 AM',
            maxValue: '8:00 PM',
            increment: 30,
            anchor: '100%'
            }, {
            xtype: 'timefield',
            name: 'out',
            fieldLabel: 'Time Out',
            minValue: '6:00 AM',
            maxValue: '8:00 PM',
            increment: 30,
            anchor: '100%'
            }]
            });
            

Namespace: Ext.form.field

Constructors

Fields

Name Description
altFormats Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined format. Defaults to: "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A"
format The default time format string which can be overriden for localization support. The format must be valid according to Ext.Date.parse. Defaults to 'g:i A', e.g., '3:15 PM'. For 24-hour time format try 'H:i' instead.
increment The number of minutes between each time value in the list. Defaults to: 15
maxText The error text to display when the entered time is after maxValue. Defaults to: "The time in this field must be equal to or before {0}"
maxValue The maximum allowed time. Can be either a Javascript date object with a valid time value or a string time in a valid format -- see format and altFormats.
minText The error text to display when the entered time is before minValue. Defaults to: "The time in this field must be equal to or after {0}"
minValue The minimum allowed time. Can be either a Javascript date object with a valid time value or a string time in a valid format -- see format and altFormats.
pickerMaxHeight The maximum height of the Ext.picker.Time dropdown. Defaults to: 300
snapToIncrement Specify as true to enforce that only values on the increment boundary are accepted. Defaults to: false
submitFormat The date format string which will be submitted to the server. The format must be valid according to Ext.Date.parse. Defaults to format.

Methods

Name Description
setMaxValue(object) Replaces any existing maxValue with the new time and refreshes the picker's range.
setMinValue(object) Replaces any existing minValue with the new time and refreshes the picker's range.
© Copyright 2005-2011 SharpKit. All rights reserved.