javascript tolocaledatestring to date code example

Example 1: js toLocaleDateString options values

[[Weekday]]			"weekday"	"narrow", "short", "long"
[[Era]]				"era"	"narrow", "short", "long"
[[Year]]			"year"	"2-digit", "numeric"
[[Month]]			"month"	"2-digit", "numeric", "narrow", "short", "long"
[[Day]]				"day"	"2-digit", "numeric"
[[Hour]]			"hour"	"2-digit", "numeric"
[[Minute]]			"minute"	"2-digit", "numeric"
[[Second]]			"second"	"2-digit", "numeric"
[[TimeZoneName]]	"timeZoneName"	"short", "long"

/*

https://medium.com/swlh/use-tolocaledatestring-to-format-javascript-dates-2959108ea020
https://tc39.es/ecma402/#sec-datetimeformat-abstracts

*/

Example 2: how to get date using tolocaledatestring

const date=new Date();
const options - {weekday:'long',year:'numeric',month:'long',day:'numeric'};
let today=today.toLocaleDatestring("en-IN",options);