0

my code is:

moment.locale('hr');
moment( '19 lipnja 2020', 'DD MMMM YYYY' ).format('DD-MM-YYYY');

It is giving wrong output.

"19-01-2020"

expected output.

 "19-06-2020"

Am I doing something wrong?

updated:

when I am executing moment().format('DD MMMM YYYY'); then it is giving me 16 lipnja 2020

Shubham Batra
  • 2,357
  • 5
  • 29
  • 48
  • You've tagged this with [moment-timezone], but are not using [that separate library](https://momentjs.com/timezone/)... – Heretic Monkey Jun 15 '20 at 15:51
  • 1
    If you do `lipanj` instead it does work. It does appear on the locale format but I'm not entirely sure what's happening. What's the difference between `lipanj` and `lipnja`? – MinusFour Jun 15 '20 at 16:13
  • `lipnja` seem to be not a valid month name, looking at [hr.js](https://github.com/moment/moment/blob/2.26.0/locale/hr.js#L81), `lipanj` is the value mentioned in moment.js hr localization for june. – VincenzoC Jun 15 '20 at 16:37
  • when I am doing ```moment().format('DD MMMM YYYY');``` then it is giving me 16 lipnja 2020 – Shubham Batra Jun 16 '20 at 14:04

0 Answers0