Convert an ISO Date String Into A Formatted Date In JavaScript

November - 2021
#!/usr/bin/env node

const months = [
  'January',
  'February',
  'March',
  'April',
  'May',
  'June',
  'July',
  'August',
  'September',
  'October',
  'November',
  'December',
]

const dateString = '2021-11-12T02:03:03-04:00'
const dateObject = new Date(dateString)

console.log(`${months[dateObject.getMonth()]} ${dateObject.getFullYear()}`)

Produces:

November 2021

#!/usr/bin/env node

const months = [
  'Jan.',
  'Feb.',
  'Mar.',
  'Apr.',
  'May',
  'Jun.',
  'Jul.',
  'Aug.',
  'Sept.',
  'Oct.',
  'Nov.',
  'Dec.',
]

const dateString = '2021-11-12T02:03:03-04:00'
const dateObject = new Date(dateString)

console.log(`${months[dateObject.getMonth()]} ${dateObject.getFullYear()}`)