Cleaning up locale
This commit is contained in:
parent
b09146a7a0
commit
3a6b05bc0a
1 changed files with 2 additions and 2 deletions
|
|
@ -13,8 +13,8 @@ import { ContentFromAllFeeds } from "./@types/bubo";
|
||||||
* Global filters for my Nunjucks templates
|
* Global filters for my Nunjucks templates
|
||||||
*/
|
*/
|
||||||
env.addFilter("formatDate", function (dateString): string {
|
env.addFilter("formatDate", function (dateString): string {
|
||||||
const formattedDate: string = new Date(parseInt(dateString)).toLocaleDateString();
|
const date: Date = new Date(parseInt(dateString));
|
||||||
return formattedDate !== "Invalid Date" ? formattedDate : dateString;
|
return !isNaN(date.getTime()) ? date.toLocaleString() : dateString;
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addGlobal("now", (new Date()).toUTCString());
|
env.addGlobal("now", (new Date()).toUTCString());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue