diff options
author | Eric Bailey <git@esb.lol> | 2024-09-11 21:20:39 -0500 |
---|---|---|
committer | Eric Bailey <git@esb.lol> | 2024-09-11 21:20:39 -0500 |
commit | 9bb385a4dd54aca2b21533b7dd919ac8d0b4aeef (patch) | |
tree | 2cec2e58fc77e7e085d712624d482c62e80c94df /src/components/dialogs/nuxs/snoozing.ts | |
parent | 63444052e8db9d2333b887a5ba5fd261e7df52db (diff) | |
download | voidsky-9bb385a4dd54aca2b21533b7dd919ac8d0b4aeef.tar.zst |
Refactor, integrate nux, snoozing
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 +} |