Commit 22fdef6b by David Baumgold

Properly parse and save section release times

parent 2445845d
...@@ -313,9 +313,18 @@ function saveSubsection() { ...@@ -313,9 +313,18 @@ function saveSubsection() {
metadata[$(el).data("metadata-name")] = el.value; metadata[$(el).data("metadata-name")] = el.value;
} }
// Piece back together the date/time UI elements into one date/time string // get datetimes for start and due, stick into metadata
metadata['start'] = getEdxTimeFromDateTimeInputs('start_date', 'start_time'); _(["start", "due"]).each(function(name) {
metadata['due'] = getEdxTimeFromDateTimeInputs('due_date', 'due_time'); var date, time;
date = $("#"+name+"_date").datepicker("getDate");
time = $("#"+name+"_time").timepicker("getTime");
if (date && time) {
metadata[name] = new Date(Date.UTC(
date.getFullYear(), date.getMonth(), date.getDate(),
time.getHours(), time.getMinutes()
));
}
});
$.ajax({ $.ajax({
url: "/save_item", url: "/save_item",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment