You can use
new Date(date).toLocaleDateString();
Answer from Viplav Soni on Stack Overflow Top answer 1 of 6
58
You can use
new Date(date).toLocaleDateString();
2 of 6
40
Date.parse returns a number. You are looking for new Date. Or, if time already is a Date instance, just use time.toLocaleDateString() (and make sure it really is in every call to the function)!
function formatTime(time, prefix = "") {
return typeof time == "object" ? prefix + time.toLocaleDateString() : "";
}
TypeError: this.time.toLocaleTimeString is not a function
Try converting the timestring into a date object then you can get the localetimestring. Example: let d = new Date(this.timeString) let t = d.toLocaleTimeString() console.log(t) More on reddit.com
Bug Report - Other: TypeError: _a.toLocaleDateString is not a function
Vortex Version: 1.11.0-beta Memory: 31.87 GB System: win32 x64 (10.0.22631) Component rendering error Vortex Version: 1.11.0-beta, TypeError: _a.toLocaleDateString is not a function at remainingBar (C:\Users\Paint\AppData\Roaming\Vortex\... More on github.com
How to parse string date to something friendly
Hello there, I always get confused on how to parse date strings to something readable. I’ve the following string: "2020-07-02T17:06:52.739Z" How do I parse this string in JavaScript to be something like: June 17, 2020. (Or something like this… friendly and readable); More on forum.freecodecamp.org
toLocaleDateString is not a function in react jsx render
Im trying to convert my date into a readable format, it current outputs as 2019-02-22T20:23:52.011Z I tried adding the .toLocaleDateString to format this date but I keep getting the same error of More on stackoverflow.com
Reddit
reddit.com › r/googleappsscript › typeerror: this.time.tolocaletimestring is not a function
r/GoogleAppsScript on Reddit: TypeError: this.time.toLocaleTimeString is not a function
March 3, 2021 -
I borrowed someone's code from 2018 and am running into errors with this line:
this.timeString = this.time.toLocaleTimeString();
this.time is defined earlier. There seems to be an easy workaround, but I cannot find it.
Maybe I should resume work next week.
GitHub
github.com › Nexus-Mods › Vortex › issues › 15567
Bug Report - Other: TypeError: _a.toLocaleDateString is not a function · Issue #15567 · Nexus-Mods/Vortex
April 20, 2024 - Vortex Version: 1.11.0-beta Memory: 31.87 GB System: win32 x64 (10.0.22631) Component rendering error Vortex Version: 1.11.0-beta, TypeError: _a.toLocaleDateString is not a function at remainingBar (C:\Users\Paint\AppData\Roaming\Vortex\...
Author VortexFeedback
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleDateString
Date.prototype.toLocaleDateString() - JavaScript | MDN
The locales and options parameters may not be supported in all implementations, because support for the internationalization API is optional, and some systems may not have the necessary data. For implementations without internationalization support, toLocaleDateString() always uses the system's locale, which may not be what you want. Because any implementation that supports the locales and options parameters must support the Intl API, you can check the existence of the latter for support: ... function toLocaleDateStringSupportsLocales() { return ( typeof Intl === "object" && !!Intl && typeof Intl.DateTimeFormat === "function" ); }
ServiceNow Community
servicenow.com › community › developer-forum › tolocaledatestring-is-not-working-in-server-side-script › td-p › 1441723
Solved: toLocaleDateString is not working in server side s... - ServiceNow Community
March 28, 2022 - Solved: Hi We need to convert a date to Japanese calendar. On the client side, dt.toLocaleDateString('ja-JP-u-ca-japanese',{era: 'long'}) works and
W3Schools
w3schools.com › jsref › jsref_tolocaledatestring.asp
W3Schools.com
The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions.
Top answer 1 of 2
3
you can use
{new Date(**your date**).toLocaleDateString()}
Cheers !
2 of 2
1
Thanks to @mplungjan the issue here was item.CreateDate.S was not a date object,
I then had to use
Date Purchased: {new Date(item.CreateDate.S).toLocaleDateString()}
instead of
Date Purchased: {item.CreateDate.S.toLocaleDateString()}
GitHub
github.com › backstage › backstage › issues › 18293
🐛 Bug Report: Tech radar plugin - data source issue - i.date.toLocaleDateString is not a function · Issue #18293 · backstage/backstage
April 5, 2023 - 🐛 Bug Report: Tech radar plugin - data source issue - i.date.toLocaleDateString is not a function#18293 · Copy link · Labels · type:bugSomething isn't workingSomething isn't working · thomasmebin · opened · on Jun 16, 2023 · Issue body actions ·
Author thomasmebin
Can I Use
caniuse.com
"toLocaleDateString" | Can I use... Support tables for ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
freeCodeCamp
forum.freecodecamp.org › t › date-format-looks-different-on-brave-compared-to-edge-and-firefox › 620860
Date format looks different on brave compared to edge and firefox - The freeCodeCamp Forum
July 5, 2023 - I am working on a project where i need to format the date to get the data i need and the date is formatted as 05-July. Below is the code i have to format the date: function dateFormated() { return new Date() .toLocaleDateString("default", { day: "2-digit", month: "short" }) .replace(" ", "-"); } It shows incorrectly on brave July-05, but on Firefox and edge it shows the correct way i formatted 05-July.
Moment.js
momentjs.com › docs
Moment.js | Docs
For these reasons, we agree with MDN's statement that parsing strings with the Date object is strongly discouraged. Modern JavaScript environments will also implement the ECMA-402 specification, which provides the Intl object, and defines behavioral options of the Date object's toLocaleString, toLocaleDateString, and toLocaleTimeString functions. When using the Intl object, be aware of the following: Not every environment will implement the full specification.
TutorialsPoint
tutorialspoint.com › javascript › date_tolocaledatestring.htm
JavaScript Date toLocaleDateString() Method
This method returns only date (not time) of a date object as a string, using the locale conventions. In the following example, we are demonstrating the basic usage of JavaScript Date toLocaleDateString() method −
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleTimeString
Date.prototype.toLocaleTimeString() - JavaScript | MDN
October 30, 2025 - The locales and options parameters may not be supported in all implementations, because support for the internationalization API is optional, and some systems may not have the necessary data. For implementations without internationalization support, toLocaleTimeString() always uses the system's locale, which may not be what you want. Because any implementation that supports the locales and options parameters must support the Intl API, you can check the existence of the latter for support: ... function toLocaleTimeStringSupportsLocales() { return ( typeof Intl === "object" && !!Intl && typeof Intl.DateTimeFormat === "function" ); }