grahamar/cron-parser

DayOfWeekDescriptionBuilder not working on systems with non english locale.

Closed this issue · 1 comments

DateTimeFormat.forPattern("EEE").parseDateTime(WordUtils.capitalizeFully(exp)).dayOfWeek().getAsText(I18nMessages.getCurrentLocale());

uses the system Locale which is wrong, because the week days in Cron Expressions are always in English. Therefore the Locale should be fixed to English:

DateTimeFormat.forPattern("EEE").withLocale(Locale.ENGLISH).parseDateTime(WordUtils.capitalizeFully(exp)).dayOfWeek().getAsText(I18nMessages.getCurrentLocale());

Same problem in ExpressionParser.java at:
String currentMonthDescription = currentMonth.toString("MMM").toUpperCase();