saleor-dashboard/cypress/support/formatData/formatDate.js
Karolina Rakoczy 5ede05affe
fix failing tests (#1797)
* fix failing tests

* fix tests for gift cards

* fix tests for gift cards

* upload video only when fail

* fix preorder time

* fixed translation page

* fix navigation, stripe and adyen

* fix graphQl npm

* update stories
2022-01-31 09:37:49 +01:00

20 lines
575 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(["pl-Pl"], {
hour: "numeric",
minute: "numeric"
});
return formatter.format(date);
}