Forráskód Böngészése

fix: saving journal files to disk with wrong format

related to #5521
Tienson Qin 3 éve
szülő
commit
6c21b405d6

+ 7 - 4
src/main/frontend/date.cljs

@@ -21,8 +21,11 @@
 
 (defn journal-title-formatters
   []
-  (conj
-   #{"do MMM yyyy"
+  (->
+   (cons
+    (state/get-date-formatter)
+    (list
+     "do MMM yyyy"
      "do MMMM yyyy"
      "MMM do, yyyy"
      "MMMM do, yyyy"
@@ -48,8 +51,8 @@
      "yyyy-MM-dd EEEE"
      "yyyy_MM_dd"
      "yyyyMMdd"
-     "yyyy年MM月dd日"}
-   (state/get-date-formatter)))
+     "yyyy年MM月dd日"))
+   (distinct)))
 
 (defn get-date-time-string
   ([]

+ 6 - 4
src/main/frontend/modules/file/core.cljs

@@ -119,15 +119,17 @@
                               (state/get-preferred-format)))
             title (string/capitalize (:block/name page))
             journal-page? (date/valid-journal-title? title)
+            filename (if journal-page?
+                       (date/date->file-name journal-page?)
+                       (-> (or (:block/original-name page) (:block/name page))
+                           (util/file-name-sanity)))
             path (str
                   (if journal-page?
                     (config/get-journals-directory)
                     (config/get-pages-directory))
                   "/"
-                  (if journal-page?
-                    (date/date->file-name journal-page?)
-                    (-> (or (:block/original-name page) (:block/name page))
-                        (util/file-name-sanity))) "."
+                  filename
+                  "."
                   (if (= format "markdown") "md" format))
             file-path (config/get-file-path repo path)
             file {:file/path file-path}