Feature: add date formatting option in custom api (#2228)

This commit is contained in:
Kirill Kuznetsov 2023-10-24 02:54:04 +03:00 committed by GitHub
parent f773e026d5
commit 3c4818a2b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 2 deletions

View file

@ -123,6 +123,9 @@ module.exports = {
i18next.services.formatter.add("percent", (value, lng, options) =>
new Intl.NumberFormat(lng, { style: "percent", ...options }).format(parseFloat(value) / 100.0),
);
i18next.services.formatter.add("date", (value, lng, options) =>
new Intl.DateTimeFormat(lng, { ...options }).format(new Date(value)),
);
},
type: "3rdParty",
},