When I use toLocaleDateString in browser it returns
n = new Date()
n.toLocaleDateString()
\"2/10/2013\"
but in node.js the for
I also found this broken in node.JS. For example, in node console, type
new Date().toLocaleDateString('en-GB')
it still displays US format. Using Werner's method above, you can override default Date.toLocaleDateString() behavior for your locale:
Date.prototype.toLocaleDateString = function () {
return `${this.getDate()}/${this.getMonth() + 1}/${this.getFullYear()}`;
};