about summary refs log tree commit diff
path: root/src/components/dialogs/nuxs/snoozing.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-09-11 21:20:39 -0500
committerEric Bailey <git@esb.lol>2024-09-11 21:20:39 -0500
commit9bb385a4dd54aca2b21533b7dd919ac8d0b4aeef (patch)
tree2cec2e58fc77e7e085d712624d482c62e80c94df /src/components/dialogs/nuxs/snoozing.ts
parent63444052e8db9d2333b887a5ba5fd261e7df52db (diff)
downloadvoidsky-9bb385a4dd54aca2b21533b7dd919ac8d0b4aeef.tar.zst
Refactor, integrate nux, snoozing
Diffstat (limited to 'src/components/dialogs/nuxs/snoozing.ts')
-rw-r--r--src/components/dialogs/nuxs/snoozing.ts18
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
+}