-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b5579f
commit 30c556d
Showing
49 changed files
with
1,245 additions
and
1,070 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
lib/assets/javascripts/src/local-time/calendar_date.coffee
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import LocalTime from "./local_time" | ||
|
||
LocalTime.CalendarDate = class CalendarDate { | ||
static fromDate(date) { | ||
return new (this)(date.getFullYear(), date.getMonth() + 1, date.getDate()) | ||
} | ||
|
||
static today() { | ||
return this.fromDate(new Date) | ||
} | ||
|
||
constructor(year, month, day) { | ||
this.date = new Date(Date.UTC(year, month - 1)) | ||
this.date.setUTCDate(day) | ||
|
||
this.year = this.date.getUTCFullYear() | ||
this.month = this.date.getUTCMonth() + 1 | ||
this.day = this.date.getUTCDate() | ||
this.value = this.date.getTime() | ||
} | ||
|
||
equals(calendarDate) { | ||
return calendarDate?.value === this.value | ||
} | ||
|
||
is(calendarDate) { | ||
return this.equals(calendarDate) | ||
} | ||
|
||
isToday() { | ||
return this.is(this.constructor.today()) | ||
} | ||
|
||
occursOnSameYearAs(date) { | ||
return this.year === date?.year | ||
} | ||
|
||
occursThisYear() { | ||
return this.occursOnSameYearAs(this.constructor.today()) | ||
} | ||
|
||
daysSince(date) { | ||
if (date) { | ||
return (this.date - date.date) / (1000 * 60 * 60 * 24) | ||
} | ||
} | ||
|
||
daysPassed() { | ||
return this.constructor.today().daysSince(this) | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import LocalTime from "../local_time" | ||
|
||
LocalTime.config.i18n = { | ||
en: { | ||
date: { | ||
dayNames: [ | ||
"Sunday", | ||
"Monday", | ||
"Tuesday", | ||
"Wednesday", | ||
"Thursday", | ||
"Friday", | ||
"Saturday" | ||
], | ||
abbrDayNames: [ | ||
"Sun", | ||
"Mon", | ||
"Tue", | ||
"Wed", | ||
"Thu", | ||
"Fri", | ||
"Sat" | ||
], | ||
monthNames: [ | ||
"January", | ||
"February", | ||
"March", | ||
"April", | ||
"May", | ||
"June", | ||
"July", | ||
"August", | ||
"September", | ||
"October", | ||
"November", | ||
"December" | ||
], | ||
abbrMonthNames: [ | ||
"Jan", | ||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Oct", | ||
"Nov", | ||
"Dec" | ||
], | ||
yesterday: "yesterday", | ||
today: "today", | ||
tomorrow: "tomorrow", | ||
on: "on {date}", | ||
formats: { | ||
default: "%b %e, %Y", | ||
thisYear: "%b %e" | ||
} | ||
}, | ||
time: { | ||
am: "am", | ||
pm: "pm", | ||
singular: "a {time}", | ||
singularAn: "an {time}", | ||
elapsed: "{time} ago", | ||
second: "second", | ||
seconds: "seconds", | ||
minute: "minute", | ||
minutes: "minutes", | ||
hour: "hour", | ||
hours: "hours", | ||
formats: { | ||
default: "%l:%M%P", | ||
default_24h: "%H:%M" | ||
} | ||
}, | ||
datetime: { | ||
at: "{date} at {time}", | ||
formats: { | ||
default: "%B %e, %Y at %l:%M%P %Z", | ||
default_24h: "%B %e, %Y at %H:%M %Z" | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.