Jan 13, 2024
How about using any Date instance's toLocaleString method, and here, as for the given example ... (new Date).toLocaleString('lt') ..?
For even more fine grained formatting one should have a look into the Internationalization Web Api. Amongst others there is a Date specific Intl.DateTimeFormat.