Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Parse a Date String</title> </head> <body> <script> // Omit the DD part document.write(new Date('2021-10') + "<br>"); // Omit both MM and DD parts document.write(new Date('2021')); </script> </body> </html>