diff options
author | Paul Frazee <pfrazee@gmail.com> | 2024-09-13 08:57:41 -0700 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2024-09-13 08:57:41 -0700 |
commit | c7231537f1d18de01bb3502e508999276e47b6df (patch) | |
tree | 3f8c1e73b4bff483a2ca5bfb34c6413345e2320c /src/components/dialogs/nuxs/snoozing.ts | |
parent | 1dc7ef137cb7a546b1c84c1e7304a4f74ea1e66b (diff) | |
parent | b47bac965f5267756f9529d911e7a49aba9e3e58 (diff) | |
download | voidsky-c7231537f1d18de01bb3502e508999276e47b6df.tar.zst |
Merge branch 'ten-milly' into main
Diffstat (limited to 'src/components/dialogs/nuxs/snoozing.ts')
-rw-r--r-- | src/components/dialogs/nuxs/snoozing.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/components/dialogs/nuxs/snoozing.ts b/src/components/dialogs/nuxs/snoozing.ts new file mode 100644 index 000000000..91effd050 --- /dev/null +++ b/src/components/dialogs/nuxs/snoozing.ts @@ -0,0 +1,22 @@ +import {simpleAreDatesEqual} from '#/lib/strings/time' +import {device} from '#/storage' + +export function snooze() { + device.set(['lastNuxDialog'], new Date().toISOString()) +} + +export function unsnooze() { + device.set(['lastNuxDialog'], undefined) +} + +export function isSnoozed() { + const lastNuxDialog = device.get(['lastNuxDialog']) + if (!lastNuxDialog) return false + const last = new Date(lastNuxDialog) + const now = new Date() + // already snoozed today + if (simpleAreDatesEqual(last, now)) { + return true + } + return false +} |