Files
edx-platform/cms/static/js/utils/date_utils.js
Alexander Kryklia a63cc0b30f Edit section/subsection release dates and grading types.
Fix bok_choy test by changing course separator.
Change format of the modal title to '[Subsection/Section Name] Settings'.
Improve bok_choy test stability.
Studio: correcting modal window size name for outline settings editor
Specify full date in bok_choy tests.
Refactor bok_choy tests.
Remove .modal-editor from basic-modal.underscore
Set classes in modal window dynamically.
Studio: revising outline edit modal tip content and overall size
Rename isEditable to isEditableOnCourseOutline.
Interpolate display name.
Use graded instead of format as flag.
Studio: revising outline settings edit modal size
Fix selectors in bok_choy tests.
2014-08-07 12:27:17 -04:00

33 lines
1.2 KiB
JavaScript

define(["jquery", "date", "jquery.ui", "jquery.timepicker"], function($, date) {
var getDate = function (datepickerInput, timepickerInput) {
// given a pair of inputs (datepicker and timepicker), return a JS Date
// object that corresponds to the datetime.js that they represent. Assume
// UTC timezone, NOT the timezone of the user's browser.
var date = $(datepickerInput).datepicker("getDate");
var time = $(timepickerInput).timepicker("getTime");
if(date && time) {
return new Date(Date.UTC(
date.getFullYear(), date.getMonth(), date.getDate(),
time.getHours(), time.getMinutes()
));
} else {
return null;
}
};
var setDate = function (datepickerInput, timepickerInput, datetime) {
// given a pair of inputs (datepicker and timepicker) and the date as an
// ISO-formatted date string.
datetime = date.parse(datetime);
if (datetime) {
$(datepickerInput).datepicker("setDate", datetime);
$(timepickerInput).timepicker("setTime", datetime);
}
};
return {
getDate: getDate,
setDate: setDate
};
});