EDIT: I think it's crazy that JavaScript can talk to USB devices but can't simply pull the OS' preferred date format. Doing more research, this question is a duplicate of Javascript - Retrieve OS Date formatting. Thanks to everybody who tried to help anyway.
How do you format a date to the user's system preferred format? Previous research I have done indicates that getLocaleDateString()
will do this, however, I am still seeing incorrect behavior.
Browser's locale is set to "en_US". OS' date format is is set to 2020-03-11. When I call (new Date()).getLocaleDateString()
, I get 3/11/2020, which is not the format I'd expect. I cannot seem to find any JavaScript methods that will format to a user's preferred date format, nor can I find any settings in my browser to alter this format either. I feel like I must be doing something wrong because it seems weird that application developers would responsible for date formatting for the user.