mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Added date and time utilities.
This commit is contained in:
8
src/utils/datetime.js
Normal file
8
src/utils/datetime.js
Normal file
@ -0,0 +1,8 @@
|
||||
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);
|
||||
}
|
Reference in New Issue
Block a user