diff options
Diffstat (limited to 'src/components/dialogs/nuxs/snoozing.ts')
-rw-r--r-- | src/components/dialogs/nuxs/snoozing.ts | 18 |
1 files changed, 18 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..a36efd8ed --- /dev/null +++ b/src/components/dialogs/nuxs/snoozing.ts @@ -0,0 +1,18 @@ +import {simpleAreDatesEqual} from '#/lib/strings/time' +import {device} from '#/storage' + +export function snooze() { + device.set(['lastNuxDialog'], new Date().toISOString()) +} + +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 +} |