You have a property that is a date string. Strings don’t have a toLocaleDateString property. Convert it to a date like new Date(theDateString), then you can apply functions that are designed to work on Date objects. You can use it just fine, there is nothing in your code that prevents you doing this… Answer from DanCouper on forum.freecodecamp.org
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleDateString
Date.prototype.toLocaleDateString() - JavaScript | MDN
The toLocaleDateString() method of Date instances returns a string with a language-sensitive representation of the date portion of this date in the local timezone. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.
Discussions

date.toLocaleDateString() returns date without zeros even if locale is provided
What version of pkg are you using? 5.8.0 What version of Node.js are you using? v18.7.0 What operating system are you using? Windows 10 What CPU architecture are you using? x86_64 What Node version... More on github.com
🌐 github.com
3
September 9, 2022
string - Wrong date with javascript function toLocaleDateString() - Stack Overflow
I use the javascript function of the Date class toLocaleDateString() in a project to get the proper formatting according to the user's locale, so simple. However, the day of the month is not always... More on stackoverflow.com
🌐 stackoverflow.com
javascript - Jquery new Date - Convert to yyyy-MM-dd and use toLocaleDateString - Stack Overflow
I am not sure how to go about enforcing the toLocaleDateString AND converting the date to yyyy-MM-dd. More on stackoverflow.com
🌐 stackoverflow.com
toLocaleDateString won't equal the same string

An executable sample:

(function(){
    let dtArrivee = new Date("2018-11-13");
    let strArrivee = "";
    let options = { year: 'numeric', month: 'numeric', day: 'numeric' };
    strArrivee = dtArrivee.toLocaleDateString("fr-CA", options);
    return strArrivee == "2018-11-13";
})();

// => true

Works for me in Firefox as well, but I can reproduce your issue in Edge...

More on reddit.com
🌐 r/javascript
5
4
July 31, 2016
🌐
University of New Brunswick
cs.unb.ca › ~bremner › teaching › cs2613 › books › mdn › Reference › Global_Objects › Date › toLocaleDateString
Date.prototype.toLocaleDateString()
October 27, 2023 - const date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0)); // toLocaleDateString() without arguments depends on the implementation, // the default locale, and the default time zone console.log(date.toLocaleDateString()); // "12/11/2012" if run in en-US locale with time zone America/Los_Angeles
🌐
W3Schools
w3schools.com › jsref › jsref_tolocaledatestring.asp
JavaScript Date toLocaleDateString() Method
❮ Previous JavaScript Date Reference ... it Yourself » · The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions....
🌐
Peterbe.com
peterbe.com › plog › be-careful-with-date.tolocaledatestring
Be careful with Date.toLocaleDateString() in JavaScript - Peterbe.com
May 8, 2023 - Monday, May 8, 2023 5 comments Node, JavaScript, macOS · tl;dr; Always pass timeZone:"UTC" when calling Date.toLocaleDateString · In my browser's web console: >>> new Date('2014-11-27T02:50:49Z').toLocaleDateString("en-us", {day: "numeric"}) "26" On my server located in the same time zone: Welcome to Node.js v16.13.0.
🌐
Ceos3c
ceos3c.com › home › javascript › tolocaledatestring in javascript – for humans
toLocaleDateString in JavaScript - For Humans
June 30, 2022 - const event = new Date(Date.UTC(2022, 02, 24, 3, 0, 0)); console.log(event.toLocaleDateString('en-US')); //displays the date in US format console.log(event.toLocaleDateString('ko-KR')); //displays the date in Korean format console.log(event.toLocaleDateString('fa-IR')); //displays the date in Persian Format console.log(event.toLocaleDateString('ja-JP-u-ca-japanese')); //displays the date in Japanese format, where 2022 is the 4th year in the Reiwa era. Code language: JavaScript (javascript)
🌐
GitHub
github.com › vercel › pkg › issues › 1749
date.toLocaleDateString() returns date without zeros even if locale is provided · Issue #1749 · vercel/pkg
September 9, 2022 - const now = new Date(); console.log(now.toLocaleDateString(), now.toLocaleDateString('en-GB')); // 9/9/2022 9/9/2022 · As you can see its the same. But, as script, the same, it returns with zeros in both cases: const now = new Date(); console.log(now.toLocaleDateString(), now.toLocaleDateString('en-GB')); // 09/09/2022 09/09/2022 ·
Published   Sep 09, 2022
Find elsewhere
🌐
Linangdata
linangdata.com › snippets-of-javascript › format-date
How to format a JavaScript date?
July 13, 2022 - const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; const today = new Date(); today.toLocaleDateString("ja-JP", options); // 2022年9月15日木曜日
🌐
Yugien
yugien.xyz › web › javascript › tolocaledatestring.html
toLocaleDateString - 日付の地域フォーマット - JavaScript
toLocaleDateStringメソッドは、Dateオブジェクトのインスタンスメソッドであり、指定された地域の規則に従って日付を文字列形式で返します。このメソッドは地域や表示オプションをカスタマイズすることが可能で、選択した地域の言語や日付形式(例えば、アメリカでは月/日/年、ヨーロッパの多くの国では日/月/年)に基づいて日付を適切に表示します。
🌐
Substack
patrickojeh.substack.com › p › a-guide-to-formatting-dates-with
A Guide to Formatting Dates with toLocaleDateString in JavaScript
January 10, 2025 - The toLocaleDateString() is a method of the JavaScript Date object that returns a string with a date formatted according to the specified locale or the default locale of the runtime environment.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toDateString
Date.prototype.toDateString() - JavaScript | MDN
The toDateString() method of Date instances returns a string representing the date portion of this date interpreted in the local timezone.
🌐
TutorialsPoint
tutorialspoint.com › javascript › date_tolocaledatestring.htm
JavaScript Date toLocaleDateString() Method
In JavaScript, the Date.toLocaleDateString() method is used to convert a date object to a string, representing the date portion of the date according to the current locale format.
🌐
Mozilla
interactive-examples.mdn.mozilla.net › pages › js › date-tolocaledatestring.html
JavaScript Demo: Date.toLocaleDateString()
const event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', }; console.log(event.toLocaleDateString('de-DE', options)); // Expected output (varies according to local timezone): Donnerstag, 20.
🌐
W3Schools
w3schools.com › jsref › event_onclick.asp
onclick Event
new Date() constructor getDate() getDay() getFullYear() getHours() getMilliseconds() getMinutes() getMonth() getSeconds() getTime() getTimezoneOffset() getUTCDate() getUTCDay() getUTCFullYear() getUTCHours() getUTCMilliseconds() getUTCMinutes() getUTCMonth() getUTCSeconds() now() parse() prototype setDate() setFullYear() setHours() setMilliseconds() setMinutes() setMonth() setSeconds() setTime() setUTCDate() setUTCFullYear() setUTCHours() setUTCMilliseconds() setUTCMinutes() setUTCMonth() setUTCSeconds() toDateString() toISOString() toJSON() toLocaleDateString() toLocaleTimeString() toLocaleString() toString() toTimeString() toUTCString() UTC() valueOf() JS Function
🌐
Tutorial Gateway
tutorialgateway.org › javascript-tolocaledatestring
JavaScript toLocaleDateString
March 29, 2025 - The JavaScript toLocaleDateString function converts the Date portion of a given date to a string using system locale conversation.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-tolocaledatestring-method
JavaScript Date toLocaleDateString() Method - GeeksforGeeks
July 11, 2025 - The toLocaleDateString() method in JavaScript is used to convert the date and time of a Date object to a string representing the date portion using the locale-specific conventions.