Date formatting: Locale of short days and short months names

  • Hi everybody,
    I’m formatting dates with quasar Date, and I want to pass my locale short day names ‘ddd’ (3 characters spanish names like [‘Lun’,‘Mar’,‘Mier’…]) as a parameter to the formatDate function, in the doc I only find two properties, one for long day names and other for long month names.
    Any way to achieve this, passing properties to this formatDate function, or setting the internal quasar i18n locale in some way? And for short months names also?
    Thanks in advance!

    let formattedString = date.formatDate(timesStamp, 'MMMM - dddd', {
      dayNames: ['Duminica', 'Luni', /* and all the rest of days - remember starting with Sunday */],
      monthNames: ['Ianuarie', 'Februarie', /* and all the rest of months */]

  • Possible on v0.15, docs will be out soon!

  • I’m using v0.15 and it does not work for me.

      new Date('2018-04-02'), 'MMMM',
          monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre'] 

    shows me : April instead of Avril

    Any idea of what I’m doing wrong ?

  • @Al1_andre I have the same problem, did you found the solution?

  • I’ve solved it.
    In fact we don’t have to specify any month names for the language we are translating to if it’s supported by Vue l18n
    But we have to specify a language pack in the framework property in quasar.conf.js.
    So now I have the month in the language I want.

    It’s explained in the in the internationalization section of the docs but it’s not mentioned in the date utils section…

Log in to reply