Skip to content

Commit

Permalink
Removes week_year date format (#63384)
Browse files Browse the repository at this point in the history
week_year is replaced by weekyear. This is a single field YYYY date
format.
follow up after a deprecation #63307
relates #60707
  • Loading branch information
pgomulka authored Oct 12, 2020
1 parent b8dabce commit 15a2a35
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 19 deletions.
5 changes: 0 additions & 5 deletions server/src/main/java/org/elasticsearch/common/joda/Joda.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ public static JodaDateFormatter forPattern(String input) {
formatter = ISODateTimeFormat.weekDateTime();
} else if ("weekDateTimeNoMillis".equals(input) || "week_date_time_no_millis".equals(input)) {
formatter = ISODateTimeFormat.weekDateTimeNoMillis();
} else if ("week_year".equals(input)) {
deprecationLogger.getOrCompute()
.deprecate("week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " +
"Use \"weekyear\" format instead");
formatter = ISODateTimeFormat.weekyear();
} else if ("weekyear".equals(input) ) {
formatter = ISODateTimeFormat.weekyear();
} else if ("weekyearWeek".equals(input) || "weekyear_week".equals(input)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,10 +1170,6 @@ public class DateFormatters {
/*
* Returns a formatter for a four digit weekyear. (YYYY)
*/
private static final DateFormatter WEEK_YEAR = new JavaDateFormatter("week_year",
new DateTimeFormatterBuilder().appendValue(WEEK_FIELDS_ROOT.weekBasedYear()).toFormatter(Locale.ROOT)
.withResolverStyle(ResolverStyle.STRICT));

private static final DateFormatter WEEKYEAR = new JavaDateFormatter("weekyear",
new DateTimeFormatterBuilder().appendValue(WEEK_FIELDS_ROOT.weekBasedYear()).toFormatter(Locale.ROOT)
.withResolverStyle(ResolverStyle.STRICT));
Expand Down Expand Up @@ -1723,11 +1719,6 @@ public class DateFormatters {
return WEEK_DATE_TIME;
} else if (FormatNames.WEEK_DATE_TIME_NO_MILLIS.matches(input)) {
return WEEK_DATE_TIME_NO_MILLIS;
} else if (FormatNames.WEEK_YEAR.matches(input)) {
deprecationLogger.getOrCompute()
.deprecate("week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " +
"Use \"weekyear\" format instead");
return WEEK_YEAR;
} else if (FormatNames.WEEKYEAR.matches(input)) {
return WEEKYEAR;
} else if (FormatNames.WEEK_YEAR_WEEK.matches(input)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public enum FormatNames {
WEEK_DATE("week_date"),
WEEK_DATE_TIME("week_date_time"),
WEEK_DATE_TIME_NO_MILLIS("week_date_time_no_millis"),
WEEK_YEAR("week_year"),
WEEKYEAR("weekyear"),
WEEK_YEAR_WEEK("weekyear_week"),
WEEKYEAR_WEEK_DAY("weekyear_week_day"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -876,9 +875,7 @@ private static String randomJodaAndJavaSupportedTimezone(List<String> zoneIds) {
* Generate a random valid date formatter pattern.
*/
public static String randomDateFormatterPattern() {
//WEEKYEAR should be used instead of WEEK_YEAR
EnumSet<FormatNames> formatNames = EnumSet.complementOf(EnumSet.of(FormatNames.WEEK_YEAR));
return randomFrom(formatNames).getName();
return randomFrom(FormatNames.values()).getName();
}

/**
Expand Down

0 comments on commit 15a2a35

Please sign in to comment.