mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
* 🐛 Add missing order by clause to snapshot query This fixes the incorrect snapshot visibility when file has a lot of versions. * ⚡ Reduce allocation on milestone-group* component * 🐛 Fix milestone group timestamp formatting * 📎 Update changelog * 🐛 Fix scroll on history panel --------- Co-authored-by: Eva Marco <evamarcod@gmail.com>
38 lines
1.2 KiB
Clojure
38 lines
1.2 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS INC
|
|
|
|
(ns app.main.ui.ds.utilities.date
|
|
(:require-macros
|
|
[app.main.style :as stl])
|
|
(:require
|
|
[app.common.time :as ct]
|
|
[app.main.ui.ds.foundations.typography :as t]
|
|
[app.main.ui.ds.foundations.typography.text :refer [text*]]
|
|
[rumext.v2 :as mf]))
|
|
|
|
(defn valid-date?
|
|
[date]
|
|
(or (ct/inst? date) (number? date)))
|
|
|
|
(def ^:private schema:date
|
|
[:map
|
|
[:class {:optional true} :string]
|
|
[:as {:optional true} :string]
|
|
[:date [:fn valid-date?]]
|
|
[:selected {:optional true} :boolean]
|
|
[:typography {:optional true} :string]])
|
|
|
|
(mf/defc date*
|
|
{::mf/schema schema:date}
|
|
[{:keys [class date selected typography] :rest props}]
|
|
(let [date (cond-> date (not (ct/inst? date)) ct/inst)
|
|
typography (or typography t/body-medium)]
|
|
[:> text* {:as "time"
|
|
:typography typography
|
|
:class [class (stl/css-case :date true :is-selected selected)]
|
|
:date-time (ct/format-inst date :iso)}
|
|
(ct/format-inst date :localized-date-time)]))
|