Skip to content

Commit

Permalink
Use weekyear for WEEK_YEAR format name
Browse files Browse the repository at this point in the history
Relates: elastic#60707

With the deprecation of camel case names in elastic#59555,
the format "weekyear" was deprecated in favour of
"week_year". This is inconsistent with other weekyear
formats however, that use "weekyear", for example

```
WEEKYEAR_WEEK("weekyear_week"),
WEEKYEAR_WEEK_DAY("weekyear_week_day"),
```

This commit keeps "weekyear" as the snake case name
for the enum constant FormatNames.WEEK_YEAR. In addition,
the format for DateFormatter WEEK_YEAR is changed to
"weekyear".
  • Loading branch information
russcam committed Aug 7, 2020
1 parent 8e9f8ba commit 3a5784d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ public class DateFormatters {
/*
* Returns a formatter for a four digit weekyear. (YYYY)
*/
private static final DateFormatter WEEK_YEAR = new JavaDateFormatter("week_year",
private static final DateFormatter WEEK_YEAR = new JavaDateFormatter("weekyear",
new DateTimeFormatterBuilder().appendValue(WEEK_FIELDS_ROOT.weekBasedYear()).toFormatter(Locale.ROOT)
.withResolverStyle(ResolverStyle.STRICT));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public enum FormatNames {
WEEK_DATE("weekDate", "week_date"),
WEEK_DATE_TIME("weekDateTime", "week_date_time"),
WEEK_DATE_TIME_NO_MILLIS("weekDateTimeNoMillis", "week_date_time_no_millis"),
WEEK_YEAR("weekyear", "week_year"),
WEEK_YEAR(null, "weekyear"),
WEEK_YEAR_WEEK("weekyearWeek", "weekyear_week"),
WEEKYEAR_WEEK_DAY("weekyearWeekDay", "weekyear_week_day"),
YEAR(null, "year"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,9 @@ public void testDuellingFormatsValidParsing() {
assertSameDate("2012-1-31", "yearMonthDay");
assertSameDate("2012-12-1", "yearMonthDay");

assertSameDate("2018", "week_year");
assertSameDate("1", "week_year");
assertSameDate("2017", "week_year");
assertSameDate("2018", "weekyear");
assertSameDate("1", "weekyear");
assertSameDate("2017", "weekyear");

assertSameDate("2018-W29", "weekyear_week");
assertSameDate("2018-W1", "weekyear_week");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public void testCamelCaseDeprecation() {
"dateHourMinuteSecond", "dateHourMinuteSecondFraction", "dateHourMinuteSecondMillis", "dateOptionalTime",
"dateTime", "dateTimeNoMillis", "hourMinute", "hourMinuteSecond", "hourMinuteSecondFraction", "hourMinuteSecondMillis",
"ordinalDate", "ordinalDateTime", "ordinalDateTimeNoMillis", "timeNoMillis",
"tTime", "tTimeNoMillis", "weekDate", "weekDateTime", "weekDateTimeNoMillis", "weekyear", "weekyearWeek", "weekyearWeekDay",
"tTime", "tTimeNoMillis", "weekDate", "weekDateTime", "weekDateTimeNoMillis", "weekyearWeek", "weekyearWeekDay",
"yearMonth", "yearMonthDay", "strictBasicWeekDate", "strictBasicWeekDateTime",
"strictBasicWeekDateTimeNoMillis", "strictDate", "strictDateHour", "strictDateHourMinute", "strictDateHourMinuteSecond",
"strictDateHourMinuteSecondFraction", "strictDateHourMinuteSecondMillis", "strictDateOptionalTime",
Expand Down

0 comments on commit 3a5784d

Please sign in to comment.