
* add test for creating preorder variant * all tests for creating & editing variants in preorder
20 lines
568 B
JavaScript
20 lines
568 B
JavaScript
export function formatDate(date) {
|
|
const day = getPeriodValue(date, { day: "2-digit" });
|
|
const month = getPeriodValue(date, { month: "2-digit" });
|
|
const year = getPeriodValue(date, { year: "numeric" });
|
|
|
|
return new Array(year, month, day).join("-");
|
|
}
|
|
|
|
function getPeriodValue(date, option) {
|
|
const formatter = new Intl.DateTimeFormat("en-us", option);
|
|
return formatter.format(date);
|
|
}
|
|
|
|
export function formatTime(date) {
|
|
const formatter = new Intl.DateTimeFormat([], {
|
|
hour: "numeric",
|
|
minute: "numeric"
|
|
});
|
|
return formatter.format(date);
|
|
}
|