Skip to content

Commit

Permalink
Fixed issue with "next ..." in Italian dates (andrewplummer#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewplummer committed Aug 16, 2018
1 parent d920840 commit 29565d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/locales/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ Sugar.Date.addLocale('it', {
'{0?} {shift} {unit:5-7}'
],
'timeParse': [
'{shift?} {day|weekday}',
'{day|weekday} {shift?}',
'{weekday?},? {date} {months?}\\.? {year?}'
],
'timeFrontParse': [
'{shift?} {day|weekday}',
'{day|weekday} {shift?}',
'{weekday?},? {date} {months?}\\.? {year?}'
]
});
11 changes: 7 additions & 4 deletions test/tests/locales/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ namespace('Date | Italian', function () {
assertDateParsed("l'anno scorso", getRelativeDate(-1));
assertDateParsed("l'anno prossimo", getRelativeDate(1));

assertDateParsed('prossimo lunedì', testGetWeekday(1, 1));
assertDateParsed('scorsa lunedì', testGetWeekday(1, -1));
assertDateParsed('lunedì prossimo', testGetWeekday(1, 1));
assertDateParsed('lunedì scorsa', testGetWeekday(1, -1));

assertDateParsed('scorsa lunedì 3:45', testGetWeekday(1, -1, 3, 45));
assertDateNotParsed('prossimo lunedì');
assertDateNotParsed('scorsa lunedì');

assertDateParsed('lunedì scorsa 3:45', testGetWeekday(1, -1, 3, 45));

// No accents
assertDateParsed('Giovedì, 5 Gennaio 2012', new Date(2012, 0, 5));
Expand All @@ -82,7 +85,7 @@ namespace('Date | Italian', function () {
equal(run(testCreateDate('2012/08/25', 'ux_UX'), 'isValid'), true, 'System intelligible formats are still parsed');

assertDateParsed('17:32 18 agosto', new Date(now.getFullYear(), 7, 18, 17, 32));
assertDateParsed('17:32 prossimo lunedì', testGetWeekday(1, 1, 17, 32));
assertDateParsed('17:32 lunedì prossimo', testGetWeekday(1, 1, 17, 32));

assertDateParsed('domani alle 3:30', testDateSet(getRelativeDateReset(0,0,1), {hour:3,minute:30}));

Expand Down

0 comments on commit 29565d3

Please sign in to comment.