~pepe/bearimy

ad8f16d6eab287120d87b9d66c48ac6123771eab — Josef Pospíšil 3 months ago 6a62fa2
Only now could be local time
1 files changed, 7 insertions(+), 3 deletions(-)

M bearimy/init.janet
M bearimy/init.janet => bearimy/init.janet +7 -3
@@ 47,15 47,19 @@
        (def {:month m :year y :month-day d :week-day wd
              :minutes u :hours h :seconds s} (os/date (:epoch self)))
        (string/format "%s, %.2i %s %.4i %i:%.2i:%.2i GMT"
                       (get-in week-days [:short wd]) (inc d) (get-in months [:short m]) y h u s))}
                       (get-in week-days [:short wd]) (inc d)
                       (get-in months [:short m]) y h u s))}
    Date))

(defn- table-date [&opt dt]
  (default dt (os/time))
  (merge (os/date dt (dyn :local-time))))
  (merge (os/date dt)))

(defn now []
  (make DateTime (table-date)))
  (make DateTime
        (table-date
          (os/mktime
            (os/date (os/time) (dyn :local-time))))))

(defn today []
  (make Date (merge-into (table-date) midnite)))