From cc8efd51e4ffb9bbe0fa9fef4936cf31f7ff21c8 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Mon, 17 Oct 2016 17:14:40 -0700 Subject: updates to time utils --- management/editor/editor.go | 7 +++++++ management/manager/manager.go | 5 ++++- system/admin/static/common/js/util.js | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/management/editor/editor.go b/management/editor/editor.go index 13043d3..8932c51 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -82,6 +82,13 @@ func Form(post Editable, fields ...Field) ([]byte, error) { +
+ + +
` diff --git a/management/manager/manager.go b/management/manager/manager.go index 8f4ea05..083f946 100644 --- a/management/manager/manager.go +++ b/management/manager/manager.go @@ -31,6 +31,7 @@ const managerHTML = ` dt.hour.val(time.hh); dt.minute.val(time.mm); + dt.period.val(time.pd); dt.year.val(date.yyyy); dt.month.val(date.mm); dt.day.val(date.dd); @@ -42,8 +43,9 @@ const managerHTML = ` // if it is empty, set it to now and use that value for time and date var publish_time_hh = $('input.__ponzu.hour'), publish_time_mm = $('input.__ponzu.minute'), + publish_time_pd = $('select.__ponzu.period'), publish_date_yyyy = $('input.__ponzu.year'), - publish_date_mm = $('input.__ponzu.month'), + publish_date_mm = $('select.__ponzu.month'), publish_date_dd = $('input.__ponzu.day'), timestamp = $('input.__ponzu.timestamp'), updated = $('input.__ponzu.updated'), @@ -51,6 +53,7 @@ const managerHTML = ` return { hour: publish_time_hh, minute: publish_time_mm, + period: publish_time_pd, year: publish_date_yyyy, month: publish_date_mm, day: publish_date_dd diff --git a/system/admin/static/common/js/util.js b/system/admin/static/common/js/util.js index 7bd821d..7f4c8ab 100644 --- a/system/admin/static/common/js/util.js +++ b/system/admin/static/common/js/util.js @@ -31,7 +31,16 @@ function getPartialTime(unix) { if (hours < 10) { hours = "0" + String(hours); } + t.hh = hours; + if (hours > 12) { + t.hh = hours - 12; + t.pd = "PM"; + } else if (hours === 12) { + t.pd = "PM"; + } else if (hours < 12) { + t.pd = "AM"; + } var minutes = date.getMinutes(); if (minutes < 10) { -- cgit v1.2.3