0
$.datepicker.formatDate('M dd', date)

I have tried this but its giving me error

jquery-ui.js:8924 Uncaught TypeError: date.getDate is not a function

Malika
  • 7
  • 5

1 Answers1

0

The formatDate method expects a Date instance.

If you're starting with that particular string, you can easily convert it to ISO 8601 format then parse it into a Date instance

const date = "2020-10-08 09:38:08"
const dateInstance = new Date(date.replace(" ", "T"))

const formatted = $.datepicker.formatDate('M dd', dateInstance)
Phil
  • 157,677
  • 23
  • 242
  • 245