From bcca89ebfd9ea93356d934edd5218335430746b6 Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Tue, 2 Jun 2015 17:29:57 -0400 Subject: Add 'date' field type --- themes/okadmin/public/js/app.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'themes/okadmin/public/js/app.js') diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index f989c7b..d58cb2a 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -162,6 +162,25 @@ var OKAdmin = function(){ $id.val( slug ) } + // Parse date input + $('.property .date').each(function(i, el) { + var name = $(el).parent('.property').data('name') + var $input = $(el).find('input') + var date = new Date($input.val()) + // Set to middle of day so it is the same date + // for all locales + date.setUTCHours(12) + var dateString = date.toUTCString() + var normalizedInput = document.createElement('input') + $(normalizedInput).attr({ + name: name, + type: 'text', + value: dateString + }) + $input.remove() + $(el).append(normalizedInput) + }) + $("ol").each(function(){ $("li", this).each(function(index){ $(this).find("input,textarea").each(function(){ -- cgit v1.2.3-70-g09d2