Applies all of the feedback for the new page

This commit is contained in:
Bryce
2024-04-14 22:29:01 -07:00
parent 6031f15246
commit 71b5b9864c
10 changed files with 74 additions and 53 deletions

View File

@@ -1,5 +1,6 @@
(ns auto-ap.time
(:require [clj-time.core :as time]
[clj-time.coerce :as coerce]
[clj-time.format :as f]
[auto-ap.logging :as alog]))
@@ -40,7 +41,7 @@
(defn unparse-local [v format]
(try
(f/unparse (f/with-zone (f/formatter format) (time/time-zone-for-id "America/Los_Angeles")) v)
(catch Exception _
nil)))
@@ -52,3 +53,14 @@
d
(recur (time/plus d (time/days 1)))))]
(iterate #(time/plus % (time/days 7)) next-day)))
(defn local-today []
(coerce/in-time-zone (time/now) (time/time-zone-for-id "America/Los_Angeles")))
(defn last-monday []
(loop [current (local-now)]
(if (= 1 (time/day-of-week current))
current
(recur (time/minus current (time/days 1))))))