Browse Source

Add support for change start of week in calendar

shady2k 4 năm trước cách đây
mục cha
commit
c17d8f14c9
2 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 8 0
      src/main/frontend/state.cljs
  2. 1 1
      src/main/frontend/ui/date_picker.cljs

+ 8 - 0
src/main/frontend/state.cljs

@@ -1021,4 +1021,12 @@
   []
   @editor-op)
 
+(defn get-start-of-week
+  []
+  (or
+   (when-let [repo (get-current-repo)]
+     (get-in @state [:config repo :start-of-week]))
+   (get-in @state [:me :settings :start-of-week])
+   6))
+
 (defonce diffs (atom nil))

+ 1 - 1
src/main/frontend/ui/date_picker.cljs

@@ -211,7 +211,7 @@
            (reset! *internal-model (first (:rum/args state)))
            state)}
   [model {:keys [on-change on-switch disabled? start-of-week class style attr]
-          :or   {start-of-week 6} ;; Default to Sunday
+          :or   {start-of-week (state/get-start-of-week)} ;; Default to Sunday
           :as   args}]
   (let [internal-model (util/react *internal-model)
         display-month (first-day-of-the-month (or internal-model (now->utc)))