You can use

new Date(date).toLocaleDateString();
Answer from Viplav Soni on Stack Overflow
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-typeerror-tolocaledatestring-is-not-a-function
TypeError: toLocaleDateString is not a function in JS [Fix] | bobbyhadz
Copied!const d1 = new Date().toLocaleDateString('en-US'); console.log(d1); const d2 = new Date('Sept 24, 22 13:20:18').toLocaleDateString( 'en-US', ); console.log(d2); // 👉️ 9/24/2022 ... You can get a date object by passing a valid date to the Date() constructor. Note that if an invalid date is passed to the Date() constructor, you would get "Invalid date" back.
Discussions

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
🌐 github.com
8
April 20, 2024
javascript - toLocaleDateString is not a function in react jsx render - Stack Overflow
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
🌐 stackoverflow.com
Can't get .toLocaleDateString('en-GB') to work keeps it as US
I am using the following code to return a GB date and time format but it just won’t change it from a US format What am i doing wrong. const sd = new Date() const SysDate = sd.toLocaleDateString(‘en-GB’) const Systime = sd.toLocaleTimeString(‘en-GB’, {timeStyle: ‘short’ } ) More on forum.wixstudio.com
🌐 forum.wixstudio.com
0
September 27, 2019
Date format looks different on brave compared to edge and firefox
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(" ", "-"); ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
July 5, 2023
🌐
Reactgo
reactgo.com › home › how to solve tolocaledatestring is not a function in javascript
How to Solve toLocaleDateString is not a Function in JavaScript | Reactgo
September 13, 2023 - const value = new Date(); if(typeof value === 'object' && value !== null && 'toLocaleDateString' in value){ console.log(value.toLocaleDateString()); }else{ console.log('Given value is not a Date object'); }
🌐
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" ); }
🌐
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
🌐
W3Schools
w3schools.com › jsref › jsref_tolocaledatestring.asp
JavaScript Date toLocaleDateString() Method
The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
🌐
Peterbe.com
peterbe.com › plog › be-careful-with-date.tolocaledatestring
Be careful with Date.toLocaleDateString() in JavaScript - Peterbe.com
May 8, 2023 - A better way is to force Date.toLocaleString to be fed a timezone. Now it's controlled at the highest level: export function formatDateBasic(date: string) { return new Date(date).toLocaleDateString("en-us", { year: "numeric", month: "long", day: "numeric", + timeZone: "UTC" }); }
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-tolocaledatestring-method
JavaScript Date toLocaleDateString() Method - GeeksforGeeks
July 11, 2025 - Returns a date as a string value in a specific format that is specified by the locale. Note: The dateObj should be a valid Date object. Example 1: Formatting Date with JavaScript's toLocaleDateString()
🌐
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 - toLocaleDateString does not seem to be supported Created a custom Japanese calendar conversion script ... You will need to use this script instead of toLocaleDateString to get the same functionality as per your requirement, just change the code as per your req:
🌐
MSR
rajamsr.com › home › how to use tolocaledatestring() to create stunning date formats
How to Use toLocaleDateString() to Create Stunning Date Formats | MSR - Web Dev Simplified
March 4, 2024 - Using the JavaScript typeof operator, you can check the type of object. You can check whether an object is an instance of a particular class using the JavaScript instanceof operator. Here’s an example of how to avoid “.toLocaleDateString is not a function” error:
🌐
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.
🌐
Wix Studio
forum.wixstudio.com › ask the community
Can't get .toLocaleDateString('en-GB') to work keeps it as US - Ask the community - Community Support Forum | Wix Studio
September 27, 2019 - I am using the following code to return a GB date and time format but it just won’t change it from a US format What am i doing wrong. const sd = new Date() const SysDate = sd.toLocaleDateString(‘en-GB’) const Sy…
🌐
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
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 ...
🌐
TutorialsPoint
tutorialspoint.com › javascript › date_tolocaledatestring.htm
JavaScript Date toLocaleDateString() Method
We are also setting the locale to "en-US" − · <html> <body> <script> const today = new Date(); const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; const dateString = today.toLocaleDateString('en-US', options); document.write(dateString); </script> </body> </html>
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleTimeString
Date.prototype.toLocaleTimeString() - JavaScript | MDN
October 30, 2025 - 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" ); }