1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00
foris-js/src/utils/datetime.js

10 lines
285 B
JavaScript
Raw Normal View History

2020-02-20 14:30:28 +01:00
import moment from "moment";
2020-08-18 15:39:00 +02:00
export function toLocaleDateString(
date,
{ inputFormat, outputFormat = "LLL" } = {}
) {
2020-02-20 14:30:28 +01:00
const parsedDate = inputFormat ? moment(date, inputFormat) : moment(date);
2020-08-18 15:39:00 +02:00
return parsedDate.locale(ForisTranslations.locale).format(outputFormat);
2020-02-20 14:30:28 +01:00
}