I need to change format from 2022-12-30 to 30-12-2022 (DD/MM/YYYY)
But I need to keep it as DATE object, not as string
Here what I've tried:
obj.created_at // return string 2022-12-30 (YYYY-MM-DD)
new Date(obj.created_at) // return date 12/30/2022 (MM/DD/YYYY)
new Date(obj.created_at).toLocaleDateString('id-ID') // return string 30/12/2022 (DD/MM/YYYY), this is the correct format, but it's a string not a date
moment(obj.created_at).toDate() // return date 12/30/2022 (MM/DD/YYYY)
moment(obj.created_at).format('DD/MM/YYYY') // return string 30/12/2022 (DD/MM/YYYY), this is the correct format, but it's a string not a date
moment(obj.created_at, 'YYYY-MM-DD').toDate() // return date 12/30/2022 (MM/DD/YYYY)
Thank you :)