mirror of https://github.com/logseq/logseq
fix: unused time dep and duplicated time-ms fns
cljs-time shouldn't be added to nbb.edn since it's already included in nbb-logseq (since parts of it aren't nbb compatible). duplicated time-ms fns can now be removed since they are available to all deps from common deppull/10793/head
parent
ece3b6df69
commit
690764aa52
|
@ -1,7 +1,4 @@
|
|||
{:paths ["src" "resources"]
|
||||
:deps
|
||||
{com.andrewmcveigh/cljs-time
|
||||
{:git/url "https://github.com/logseq/cljs-time" ;; fork
|
||||
:sha "5704fbf48d3478eedcf24d458c8964b3c2fd59a9"}
|
||||
io.github.nextjournal/nbb-test-runner
|
||||
{io.github.nextjournal/nbb-test-runner
|
||||
{:git/sha "60ed57aa04bca8d604f5ba6b28848bd887109347"}}}
|
||||
|
|
|
@ -332,6 +332,7 @@
|
|||
(remove nil?)))
|
||||
|
||||
(defn time-ms
|
||||
"Current time in milliseconds"
|
||||
[]
|
||||
(tc/to-long (t/now)))
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
(:require [logseq.db.frontend.default :as default-db]
|
||||
[logseq.db.frontend.schema :as db-schema]
|
||||
[datascript.core :as d]
|
||||
[cljs-time.core :as t]
|
||||
[cljs-time.coerce :as tc]
|
||||
[clojure.string :as string]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.config :as common-config]
|
||||
|
@ -88,7 +86,7 @@
|
|||
|
||||
(defn build-default-pages-tx
|
||||
[]
|
||||
(let [time (tc/to-long (t/now))]
|
||||
(let [time (common-util/time-ms)]
|
||||
(map
|
||||
(fn [m]
|
||||
(-> m
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
(ns logseq.db.sqlite.util
|
||||
"Utils fns for backend sqlite db"
|
||||
(:require [cljs-time.coerce :as tc]
|
||||
[cljs-time.core :as t]
|
||||
[clojure.string :as string]
|
||||
(:require [clojure.string :as string]
|
||||
[logseq.db.frontend.schema :as db-schema]
|
||||
[logseq.common.util :as common-util]))
|
||||
|
||||
|
@ -25,15 +23,10 @@
|
|||
db-schema/schema-for-db-based-graph
|
||||
db-schema/schema))
|
||||
|
||||
(defn time-ms
|
||||
"Copy of util/time-ms. Too basic to couple this to main app"
|
||||
[]
|
||||
(tc/to-long (t/now)))
|
||||
|
||||
(defn block-with-timestamps
|
||||
"Adds updated-at timestamp and created-at if it doesn't exist"
|
||||
[block]
|
||||
(let [updated-at (time-ms)
|
||||
(let [updated-at (common-util/time-ms)
|
||||
block (cond->
|
||||
(assoc block :block/updated-at updated-at)
|
||||
(nil? (:block/created-at block))
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
[clojure.string :as string]
|
||||
[datascript.core :as d]
|
||||
[logseq.db.frontend.schema :as db-schema]
|
||||
[logseq.graph-parser.date-time-util :as date-time-util]
|
||||
[logseq.graph-parser.extract :as extract]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.config :as common-config]
|
||||
|
@ -124,7 +123,7 @@ Options available:
|
|||
:file/content content}
|
||||
new?
|
||||
;; TODO: use file system timestamp?
|
||||
(assoc :file/created-at (date-time-util/time-ms)))])
|
||||
(assoc :file/created-at (common-util/time-ms)))])
|
||||
tx' (common-util/fast-remove-nils tx)
|
||||
result (if skip-db-transact?
|
||||
tx'
|
||||
|
|
|
@ -309,7 +309,7 @@
|
|||
(when-not (string/blank? namespace)
|
||||
{:block/namespace {:block/name (common-util/page-name-sanity-lc namespace)}})))
|
||||
(when (and with-timestamp? (not page-entity)) ;; Only assign timestamp on creating new entity
|
||||
(let [current-ms (date-time-util/time-ms)]
|
||||
(let [current-ms (common-util/time-ms)]
|
||||
{:block/created-at current-ms
|
||||
:block/updated-at current-ms}))
|
||||
(if journal-day
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
(ns logseq.graph-parser.date-time-util
|
||||
"cljs-time util fns for graph-parser"
|
||||
(:require [cljs-time.coerce :as tc]
|
||||
[cljs-time.core :as t]
|
||||
[cljs-time.format :as tf]
|
||||
(:require [cljs-time.format :as tf]
|
||||
[clojure.string :as string]
|
||||
[logseq.common.util :as common-util]))
|
||||
|
||||
(defn time-ms
|
||||
"Copy of util/time-ms. Too basic to couple this to main app"
|
||||
[]
|
||||
(tc/to-long (t/now)))
|
||||
|
||||
;; (tf/parse (tf/formatter "dd.MM.yyyy") "2021Q4") => 20040120T000000
|
||||
(defn safe-journal-title-formatters
|
||||
[date-formatter]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
by the graph-parser soon but if not, it should be in its own library"
|
||||
(:require [cljs-time.core :as t]
|
||||
[logseq.graph-parser.date-time-util :as date-time-util]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.util.page-ref :as page-ref]
|
||||
[datascript.core :as d]
|
||||
[clojure.string :as string]))
|
||||
|
@ -113,7 +114,7 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
|
|||
(date->int (t/plus (t/today) (t/days 1))))
|
||||
|
||||
(defmethod resolve-keyword-input :right-now-ms [_ _ _]
|
||||
(date-time-util/time-ms))
|
||||
(common-util/time-ms))
|
||||
|
||||
;; today-time returns an epoch int
|
||||
(defmethod resolve-keyword-input :today-time [_db input _opts]
|
||||
|
|
Loading…
Reference in New Issue