Skip to content

Commit

Permalink
Change style
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzifu666 committed Feb 4, 2025
1 parent b2f9a4e commit edd8215
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5528,6 +5528,7 @@ public static String dayNameWithDate(int date, Locale locale) {
* @return The week of the year of the given date
*/
public static @Nullable Integer weekOfYear(String date) {
//CHECKSTYLE: IGNORE 1
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
calendar.setGregorianChange(new Date(Long.MIN_VALUE));
calendar.setFirstDayOfWeek(Calendar.MONDAY);
Expand Down Expand Up @@ -5558,16 +5559,18 @@ public static LocalDate valueOf(final String text) {
ParsePosition pos = new ParsePosition(0);
try {
DateTimeFormatter format =
new DateTimeFormatterBuilder().appendValue(YEAR, 1, 10, SignStyle.NORMAL)
new DateTimeFormatterBuilder()
.appendValue(YEAR, 1, 10, SignStyle.NORMAL)
.appendLiteral('-')
.appendValue(MONTH_OF_YEAR, 1, 2, SignStyle.NORMAL)
.appendLiteral('-')
.appendValue(DAY_OF_MONTH, 1, 2, SignStyle.NORMAL)
//CHECKSTYLE: IGNORE 1
.toFormatter()
.withResolverStyle(ResolverStyle.STRICT);
TemporalAccessor t = format.parseUnresolved(s, pos);
if (pos.getErrorIndex() >= 0) {
throw new DateTimeParseException("Text could not be parsed to date", s, pos.getErrorIndex());
throw new DateTimeParseException("Text could not parse to date", s, pos.getErrorIndex());
}
return LocalDate.of(t.get(YEAR), t.get(MONTH_OF_YEAR), t.get(DAY_OF_MONTH));
} catch (DateTimeException e) {
Expand Down

0 comments on commit edd8215

Please sign in to comment.