saleor-dashboard/cypress/support/formatData/formatDate.js
Karolina Rakoczy 2c64a966cc
Saleor 4437 refactor tests (#1389)
* reference type cypress working

* refactor

* remove screenshots

* add reference

* add slash marker

* run tests based on shop version

* fix run tests based on shop version

* fix run tests based on shop version

* change base url to localhost

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix yml

* fix yml

* chage file names

* fix files names

* fix broken imports add checking for errors in grpah responses

* fix broken imports add checking for errors in grpah responses

* update jest

* fix snapshot
2021-09-27 12:04:21 +02:00

12 lines
398 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);
}