da86f7eae681f96f982b24785248f05ce402fa84.svn-base 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. if (!dojo._hasResource["dojox.widget.TimeSpinner"]) { // _hasResource checks
  2. // added by build. Do
  3. // not use _hasResource
  4. // directly in your
  5. // code.
  6. dojo._hasResource["dojox.widget.TimeSpinner"] = true;
  7. dojo.provide("dojox.widget.TimeSpinner");
  8. dojo.require("dijit.form._Spinner");
  9. dojo.require("dijit.form.NumberTextBox");
  10. dojo.require("dojo.date");
  11. dojo.require("dojo.date.locale");
  12. dojo.require("dojo.date.stamp");
  13. dojo.declare("dojox.widget.TimeSpinner", [dijit.form._Spinner], {
  14. // summary: Time Spinner
  15. // description: This widget is the same as a normal
  16. // NumberSpinner, but for the time component of a date object
  17. // instead
  18. required : false,
  19. adjust : function(/* Object */val, /* Number */delta) {
  20. return dojo.date.add(val, "minute", delta)
  21. },
  22. // FIXME should we allow for constraints in this widget?
  23. isValid : function() {
  24. return true;
  25. },
  26. smallDelta : 5,
  27. largeDelta : 30,
  28. timeoutChangeRate : 0.50,
  29. parse : function(time, locale) {
  30. return dojo.date.locale.parse(time, {
  31. selector : "time",
  32. formatLength : "short"
  33. });
  34. },
  35. format : function(time, locale) {
  36. if (dojo.isString(time)) {
  37. return time;
  38. }
  39. return dojo.date.locale.format(time, {
  40. selector : "time",
  41. formatLength : "short"
  42. });
  43. },
  44. serialize : dojo.date.stamp.toISOString,
  45. value : "12:00 AM"
  46. });
  47. }