(ns com.oly.static-sites.do-blog.pages.helpers.utils
  (:require
   [clojure.string :as str]
   [tick.core :as t]
   [tick.locale-en-us]
   [tick.timezone]))

(defonce date-format (t/formatter "yyyy-MMM-dd"))

(defn format-date [text]
  (when text
    (t/format date-format text)))

(defn ltrim-slash "Right trim a leading slash" [text] (str/replace text #"^/" ""))

(defn extract-tags [text]
  (->> (clojure.string/split text #_(:filetags %) #":")
       (reduce (fn [m a] (conj m a)) [])
       vec))
