@atlaskit/datetime-picker
Version:
A date time picker allows the user to select an associated date and time.
15 lines (14 loc) • 471 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.formatDateTimeZoneIntoIso = formatDateTimeZoneIntoIso;
/**
* Formats a date, time, and zone into a ISO string.
*/
function formatDateTimeZoneIntoIso(date, time, zone) {
// 12:00 => 12:00, 1:00 => 01:00
var needsLeadingZero = /^\d:/;
var sanitizedTime = needsLeadingZero.test(time) ? "0".concat(time) : time;
return "".concat(date, "T").concat(sanitizedTime).concat(zone);
}