Rev | Line | |
---|
[483] | 1 | define([ |
---|
| 2 | "dojo/_base/declare", |
---|
| 3 | "dojo/dom-class", |
---|
| 4 | "dojo/date/locale" |
---|
| 5 | ], function(declare, domClass, datelocale){ |
---|
| 6 | |
---|
| 7 | // module: |
---|
| 8 | // dojox/mobile/_TimePickerMixin |
---|
| 9 | |
---|
| 10 | return declare("dojox.mobile._TimePickerMixin", null, { |
---|
| 11 | // summary: |
---|
| 12 | // A mixin for time picker widget. |
---|
| 13 | |
---|
| 14 | /*===== |
---|
| 15 | // date: Date |
---|
| 16 | // A Date object corresponding to the current values of the picker. |
---|
| 17 | date: null, |
---|
| 18 | =====*/ |
---|
| 19 | |
---|
| 20 | reset: function(){ |
---|
| 21 | // summary: |
---|
| 22 | // Goes to now. Resets the hour and minutes to the current time. |
---|
| 23 | var now = new Date(), |
---|
| 24 | h = now.getHours() + "", |
---|
| 25 | m = now.getMinutes(); |
---|
| 26 | m = (m < 10 ? "0" : "") + m; |
---|
| 27 | this.set("colors", [h, m]); |
---|
| 28 | if(this.values){ |
---|
| 29 | this.set("values", this.values); |
---|
| 30 | this.values = null; |
---|
| 31 | }else if(this.values12){ |
---|
| 32 | this.set("values12", this.values12); |
---|
| 33 | this.values12 = null; |
---|
| 34 | }else{ |
---|
| 35 | this.set("values", [h, m]); |
---|
| 36 | } |
---|
| 37 | }, |
---|
| 38 | |
---|
| 39 | _getDateAttr: function(){ |
---|
| 40 | // summary: |
---|
| 41 | // Returns a Date object for the current values. |
---|
| 42 | // tags: |
---|
| 43 | // private |
---|
| 44 | var v = this.get("values"); // [hour24, minute] |
---|
| 45 | return datelocale.parse(v[0] + ":" + v[1], {timePattern:"H:m", selector:"time"}); |
---|
| 46 | } |
---|
| 47 | }); |
---|
| 48 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.