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
2020-08-18 16:17:00 +02:00

10 lines
285 B
JavaScript

import moment from "moment";
export function toLocaleDateString(
date,
{ inputFormat, outputFormat = "LLL" } = {}
) {
const parsedDate = inputFormat ? moment(date, inputFormat) : moment(date);
return parsedDate.locale(ForisTranslations.locale).format(outputFormat);
}