summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Fridman <mail@seanfridman.com>2015-12-20 03:06:47 +0100
committerSean Fridman <mail@seanfridman.com>2015-12-20 03:11:36 +0100
commit57026202f9ac0b98cc744734a04bcee362b789a3 (patch)
treeb9e27ab81d4fc70e751fdd0ec2e5f89dd663c1c1
parent4b93310234f878add1fe3f6cc9df45f72b1c8f4f (diff)
Date type always defaults to current dayv0.1.18
-rw-r--r--package.json2
-rw-r--r--themes/okadmin/public/js/app.js14
2 files changed, 15 insertions, 1 deletions
diff --git a/package.json b/package.json
index b7f1105..192685c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "okcms",
- "version": "0.1.16",
+ "version": "0.1.18",
"description": "great",
"main": "app/index.js",
"scripts": {
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js
index b313f22..edf9980 100644
--- a/themes/okadmin/public/js/app.js
+++ b/themes/okadmin/public/js/app.js
@@ -20,6 +20,20 @@ var OKAdmin = function(){
}
})
+ // Add default date
+ $('.date input').each(function(i, el){
+ var value = el.getAttribute('value')
+ if (!value) {
+ el.setAttribute('value', toDateInputValue(new Date))
+ }
+
+ function toDateInputValue (date) {
+ var local = new Date(date);
+ local.setMinutes(date.getMinutes() - date.getTimezoneOffset());
+ return local.toJSON().slice(0,10);
+ }
+ })
+
// initialize our multimedia uploader with an element and a template
$(".group.media-list").each(function(){
var parent = this