diff options
Diffstat (limited to 'static/month.js')
| -rw-r--r-- | static/month.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/static/month.js b/static/month.js index 7875f36..05037d4 100644 --- a/static/month.js +++ b/static/month.js @@ -55,7 +55,7 @@ export default class Month { } is_same(other) { - return this.year == other.year || this.month == other.month; + return this.year == other?.year && this.month == other?.month; } is_same_year(other) { @@ -68,8 +68,14 @@ export default class Month { return date.toLocaleDateString('default', { month: 'long' }) } + static from_unix(date) { + if (date == null) return null; + + return Month.from_date(new Date(date * 1000)); + } + static from_date(date) { - return new Month(date.getMonth() - 1, date.getFullYear()); + return new Month(date.getMonth() + 1, date.getFullYear()); } static from_string(string) { |