Sha256: dca5ea6dc378041175723d5bcefd1895e46489fedf4372db7980f5945939c743
Contents?: true
Size: 831 Bytes
Versions: 5
Compression:
Stored size: 831 Bytes
Contents
class LocalTime.CalendarDate @fromDate: (date) -> new this date.getFullYear(), date.getMonth() + 1, date.getDate() @today: -> @fromDate(new Date) constructor: (year, month, day) -> @date = new Date Date.UTC(year, month - 1) @date.setUTCDate(day) @year = @date.getUTCFullYear() @month = @date.getUTCMonth() + 1 @day = @date.getUTCDate() @value = @date.getTime() equals: (calendarDate) -> calendarDate?.value is @value is: (calendarDate) -> @equals(calendarDate) isToday: -> @is(@constructor.today()) occursOnSameYearAs: (date) -> @year is date?.year occursThisYear: -> @occursOnSameYearAs(@constructor.today()) daysSince: (date) -> if date (@date - date.date) / (1000 * 60 * 60 * 24) daysPassed: -> @constructor.today().daysSince(this)
Version data entries
5 entries across 5 versions & 1 rubygems