2966e39c488cabdfd216454438a3f9d1ea517588.svn-base 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. if (!dojo._hasResource["dojox.dtl.filter.dates"]) { // _hasResource checks added
  2. // by build. Do not use
  3. // _hasResource directly in
  4. // your code.
  5. dojo._hasResource["dojox.dtl.filter.dates"] = true;
  6. dojo.provide("dojox.dtl.filter.dates");
  7. dojo.require("dojox.dtl.utils.date");
  8. dojo.mixin(dojox.dtl.filter.dates, {
  9. date : function(value, arg) {
  10. // summary: Formats a date according to the given format
  11. if (!value || !(value instanceof Date))
  12. return "";
  13. arg = arg || "N j, Y";
  14. return dojox.dtl.utils.date.format(value, arg);
  15. },
  16. time : function(value, arg) {
  17. // summary: Formats a time according to the given format
  18. if (!value || !(value instanceof Date))
  19. return "";
  20. arg = arg || "P";
  21. return dojox.dtl.utils.date.format(value, arg);
  22. },
  23. timesince : function(value, arg) {
  24. // summary: Formats a date as the time since that date (i.e.
  25. // "4 days, 6 hours")
  26. var timesince = dojox.dtl.utils.date.timesince;
  27. if (!value)
  28. return "";
  29. if (arg)
  30. return timesince(arg, value);
  31. return timesince(value);
  32. },
  33. timeuntil : function(value, arg) {
  34. // summary: Formats a date as the time until that date (i.e.
  35. // "4 days, 6 hours")
  36. var timesince = dojox.dtl.utils.date.timesince;
  37. if (!value)
  38. return "";
  39. if (arg)
  40. return timesince(arg, value);
  41. return timesince(allGetServerTime(), value);
  42. }
  43. });
  44. }