@atlaskit/datetime-picker
Version:
A date time picker allows the user to select an associated date and time.
9 lines • 335 B
JavaScript
/**
* Formats a date, time, and zone into a ISO string.
*/
export 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);
}