diff --git a/cps/static/js/edit_books.js b/cps/static/js/edit_books.js index 96fcc848..dd907c47 100644 --- a/cps/static/js/edit_books.js +++ b/cps/static/js/edit_books.js @@ -29,6 +29,40 @@ if ($("#description").length) { } } +if (!Modernizr.inputtypes.date) { + $("#Publishstart").datepicker({ + format: "yyyy-mm-dd", + language: language + }).on("change", function () { + // Show localized date over top of the standard YYYY-MM-DD date + var pubDate; + var results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value); // YYYY-MM-DD + if (results) { + pubDate = new Date(results[1], parseInt(results[2], 10) - 1, results[3]) || new Date(this.value); + $("#fake_Publishstart") + .val(pubDate.toLocaleDateString(language)) + .removeClass("hidden"); + } + }).trigger("change"); +} + +if (!Modernizr.inputtypes.date) { + $("#Publishend").datepicker({ + format: "yyyy-mm-dd", + language: language + }).on("change", function () { + // Show localized date over top of the standard YYYY-MM-DD date + var pubDate; + var results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value); // YYYY-MM-DD + if (results) { + pubDate = new Date(results[1], parseInt(results[2], 10) - 1, results[3]) || new Date(this.value); + $("#fake_Publishend") + .val(pubDate.toLocaleDateString(language)) + .removeClass("hidden"); + } + }).trigger("change"); +} + /* Takes a prefix, query typeahead callback, Bloodhound typeahead adapter and returns the completions it gets from the bloodhound engine prefixed. diff --git a/cps/templates/search_form.html b/cps/templates/search_form.html index d8c3a07d..ad561b19 100644 --- a/cps/templates/search_form.html +++ b/cps/templates/search_form.html @@ -14,6 +14,23 @@ + +
+
+ +
+ + +
+
+
+ +
+ + +
+
+
@@ -82,6 +99,14 @@ {% endblock %} {% block js %} + + + +{% if not g.user.locale == 'en' %} + +{% endif %}