Requires

Provides

Date.js

Work with dates like a boss

License:
Public domain (http://unlicense.org).
Authors:
Yaroslaff Fedin
  1. 23
  2. 24
  3. 25
  4. 26
  5. 27
  6. 28
  7. 29
  8. 30
  9. 31
  10. 32
  11. 33
  12. 34
  13. 35
  14. 36
  15. 37
  16. 38
  17. 39
  18. 40
  19. 41
  20. 42
  21. 43
  22. 44
  23. 45
  24. 46
  25. 47
  26. 48
  27. 49
  28. 50
  29. 51
  30. 52
  31. 53
  32. 54
  33. 55
  34. 56
  35. 57
  36. 58
  37. 59
  38. 60
LSD.Trait.Date = new Class({ options: { date: { interval: 'month' } }, setDate: function(date) { this.date = date; }, getDate: function() { if (this.date) return this.date; if (this.getRawDate) { var raw = this.getRawDate(); return raw ? this.parseDate(raw) : this.getDefaultDate(); } }, getDefaultDate: function() { return new Date; }, parseDate: function(date) { return Date.parse(date); }, increment: function(number) { number = number.toInt ? number.toInt() : 1; this.setDate(this.getDate().increment(this.options.date.interval, number)) }, decrement: function(number) { number = number.toInt ? number.toInt() : 1; this.setDate(this.getDate().decrement(this.options.date.interval, number)) } });