diff options
| author | Sean Fridman <fridman@mail.sfsu.edu> | 2015-06-02 17:29:57 -0400 |
|---|---|---|
| committer | Sean Fridman <fridman@mail.sfsu.edu> | 2015-06-02 17:29:57 -0400 |
| commit | bcca89ebfd9ea93356d934edd5218335430746b6 (patch) | |
| tree | 15ca36b109b7c22dae054106805ba02dba6b88ae /themes/okadmin/public/js/app.js | |
| parent | e923cb0e5e1efac4fba534aba87f6b6e9d95d3f0 (diff) | |
Add 'date' field typev0.1.8
Diffstat (limited to 'themes/okadmin/public/js/app.js')
| -rw-r--r-- | themes/okadmin/public/js/app.js | 19 |
1 files changed, 19 insertions, 0 deletions
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(){ |
