about summary refs log tree commit diff
path: root/src/components/dialogs/nuxs/snoozing.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2024-09-13 08:57:41 -0700
committerPaul Frazee <pfrazee@gmail.com>2024-09-13 08:57:41 -0700
commitc7231537f1d18de01bb3502e508999276e47b6df (patch)
tree3f8c1e73b4bff483a2ca5bfb34c6413345e2320c /src/components/dialogs/nuxs/snoozing.ts
parent1dc7ef137cb7a546b1c84c1e7304a4f74ea1e66b (diff)
parentb47bac965f5267756f9529d911e7a49aba9e3e58 (diff)
downloadvoidsky-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.ts22
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
+}