Sugar icon indicating copy to clipboard operation
Sugar copied to clipboard

Possible issue in Italian date parsing

Open lusentis opened this issue 7 years ago • 1 comments

Hi, in Italian dates, one may reference "next Monday" as "lunedì prossimo" (where "prossimo" is the translation of "next"), but, using the Italian locale:

  • "lunedì prossimo" is parsed as Invalid Date;
  • "prossimo lunedì" is parsed correctly, while its use is very uncommon;

I've modified my locales/it.js file to correctly parse this format. I can't understand the difference between timeParse and timeFrontParse, so I've added a format to both.

  timeParse: [
    '{shift?} {day|weekday}',
    '{weekday} {shift}', // <--- line added
    '{weekday?},? {date} {months?}\\.? {year?}'
  ],
  timeFrontParse: [
    '{shift?} {day|weekday}',
    '{weekday} {shift}', // <--- line added
    '{weekday?},? {date} {months?}\\.? {year?}'
  ]

I might send a PR for this.

Thanks,

lusentis avatar May 17 '17 13:05 lusentis

Really sorry about how long this has taken... probably not going to help you anymore but hopefully it will help someone....

andrewplummer avatar Aug 16 '18 15:08 andrewplummer