diff --git a/templates/admin/editcontest.html b/templates/admin/editcontest.html index 4b9b87b..19b581b 100644 --- a/templates/admin/editcontest.html +++ b/templates/admin/editcontest.html @@ -5,13 +5,13 @@ {% block main %}

Edit Contest

- +
- - + +
@@ -20,10 +20,19 @@

Edit Contest

var product = converter.makeHtml(document.getElementById('description').value); $('#description-out').html(product); $('#description').css('height', $('#description-out').css('height')); - }); - $(".dtl").focus(function() { - $(this).attr("type", "datetime-local"); + document.querySelectorAll(".dtl").forEach(function (e) { + var split = e.getAttribute("value").split(" "); + var date_split = split[0].split("-"); + var final = date_split[1] + "/" + date_split[2] + "/" + date_split[0] + " " + split[1]; + var parsed = new Date(final + " UTC").toString().split(" "); + e.value = parsed[3] + "-" + getMonthFromString(parsed[1]) + "-" + parsed[2] + "T" + parsed[4]; + + function getMonthFromString(mon){ + var str = (new Date(Date.parse(mon +" 1, 2012")).getMonth() + 1).toString(); + return str.length == 2 ? str : "0" + str; + } + }); }); $('#description').bind('input propertychange', function() {