We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(ns foo (:require [cljs-time.format :as f] [cljs-time.coerce :as c])) (def date-formatter (f/formatter "MM/DD/YYYY")) (defn str->date [date-as-str] (->> date-as-str (f/parse date-formatter) c/to-date)) (defn date->str [date] (->> date c/from-date (f/unparse date-formatter) )) (-> "06/23/2016" str->date date->str) ;;evaluates to "06/175/2016" when the original "06/23/2016" is expected
Am I using unparse incorrectly? why does it give "06/175/2016" and not "06/23/2016"?. I am using [org.clojure/clojurescript "1.9.76"]
The text was updated successfully, but these errors were encountered:
used moment.js instead
(require [cljsjs.moment]) (defn str->date [date-as-str] (let [m (-> date-as-str (js/moment. "MM/DD/YYYY"))] (. m toDate))) (defn date->str [date] (.. (js/moment. date) (format "MM/DD/YYYY")))
Sorry, something went wrong.
The pattern DD means day of the year. Lowercase dd is what you want for day of month.
On Fri, 24 Jun 2016 05:14 Sonny To, notifications@github.com wrote:
used moment.js instead (require [cljsjs.moment]) (defn str->date [date-as-str](let [m %28-> date-as-str %28js/moment.))] (. m toDate))) (defn date->str [date](.. %28js/moment. date%29 %28format))) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub #66 (comment), or mute the thread https://github.com/notifications/unsubscribe/AALnm4T3NA6ywnIJotovG1jHxeoOHZqkks5qO1mggaJpZM4I9cO0 .
(require [cljsjs.moment])
(defn str->date [date-as-str](let [m %28-> date-as-str %28js/moment.))] (. m toDate)))
(defn date->str [date](.. %28js/moment. date%29 %28format)))
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub #66 (comment), or mute the thread https://github.com/notifications/unsubscribe/AALnm4T3NA6ywnIJotovG1jHxeoOHZqkks5qO1mggaJpZM4I9cO0 .
No branches or pull requests
Am I using unparse incorrectly? why does it give "06/175/2016" and not "06/23/2016"?. I am using [org.clojure/clojurescript "1.9.76"]
The text was updated successfully, but these errors were encountered: