                                (unparse (:date-hour-minute formatters) (parse input-date-time-formatter %))
                                %))
         normalize ; because of GMT
-        #(to-date (plus (from-string %) (hours 6)))]
+        #(to-date (plus (from-string %) (hours 6)))
+        min-date (when (:min-date static-attrs) (:min-date static-attrs))
+        max-date (when (:max-date static-attrs) (:max-date static-attrs))
+        set-date! (fn [new-date]
+                    (when (and date-atom new-date)
+                      (if (and min-date max-date)
+                        (if (after? (from-date new-date) max-date)
+                          (reset! date-atom (out (to-string max-date)))
+                          (if (after? min-date (from-date new-date))
+                            (reset! date-atom (out (to-string min-date)))
+                            (reset! date-atom (out (to-string (minus (from-date new-date) (hours 6)))))))
+                        (reset! date-atom (out (to-string (minus (from-date new-date) (hours 6))))))))]
     (r/create-class
       {:component-did-mount
         (fn [this]

  min-date-atom: atom representing the minimum date for the selector.
  pikaday-attrs: a map of options to be passed to the Pikaday constructor.
  input-attrs: a map of options to be used as <input> tag attributes."
  [{:keys [date-atom max-date-atom min-date-atom pikaday-attrs input-attrs]}]
  (let [in #(if (from-string %)
              (unparse input-date-time-formatter (from-string %))
              %)

                {:field (.getDOMNode this)
                 :defaultDate @date-atom
                 :setDefaultDate true
                 :onSelect set-date!}
                opts (merge default-opts pikaday-attrs)
                instance (js/Pikaday. (clj->js opts))]
            (when (and (:defaultDate opts)
                       (:setDefaultDate opts))
              (when (from-date (:defaultDate opts))
                (-> this
                    r/dom-node
                    js/jQuery
                    (.val (in (to-string (minus (from-date (:defaultDate opts)) (hours 6))))))))
            ; This code could probably be neater
            (when date-atom
              (add-watch date-atom :update-instance
