skip to Main Content

i am getting a date with a format like this:

const momentDate = localDate(date)
return momentDate.format('LL')

in english i am geting good "december 5, 2023" but in spanish
that is returning me ‘5 de diciembre de 2023’ i would like get "diciembre 5, 2023"

how can i get it in that format?

2

Answers


  1. You’ll find your answer here https://momentjs.com/docs/#/displaying/format/

    You can use the chart to determine exactly the format you want.

    But also, consider that you probably don’t want to add moment to any new projects if you can avoid it, based on https://momentjs.com/docs/#/-project-status/

    Login or Signup to reply.
  2. The "LL" format in Moment.js is locale-specific and provides a long date format which typically includes the day of the month, month name, and year in a format that is standard for the specified locale.

    Instead try to customise the format like this

    const momentDate = localDate(date);
    return momentDate.format('MMMM D, YYYY');
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search