diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-24 21:13:47 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-24 21:17:05 +0100 |
| commit | f3756dac8a49f3b5599fd50f4c631da4168e9eb0 (patch) | |
| tree | a84d95e30269d4b368b741ffd1a781b7cfbb1988 /static/month.js | |
| parent | 97b35ce73fab8a84d4d3e6807618a252efcf4cd9 (diff) | |
add jump-to month
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) { |