-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calendar API changes so that methods accepting strings return strings #5029
Changes from all commits
64076f9
a22292d
8ba59b4
8cd97a4
76164a1
18ed1fd
847acd6
d7cee84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1214,14 +1214,16 @@ public LocalDate[] businessDates(final LocalDate start, final LocalDate end, fin | |
* @throws InvalidDateException if the dates are not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate[] businessDates(final String start, final String end, final boolean startInclusive, | ||
public String[] businessDates(final String start, final String end, final boolean startInclusive, | ||
final boolean endInclusive) { | ||
if (start == null || end == null) { | ||
return null; | ||
} | ||
|
||
return businessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, | ||
endInclusive); | ||
final LocalDate[] dates = | ||
businessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, | ||
endInclusive); | ||
return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); | ||
} | ||
|
||
/** | ||
|
@@ -1287,7 +1289,7 @@ public LocalDate[] businessDates(final LocalDate start, final LocalDate end) { | |
* @throws InvalidDateException if the dates are not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate[] businessDates(final String start, final String end) { | ||
public String[] businessDates(final String start, final String end) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Every other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assumed that String in implies String out. If someone is working in strings, do you expect that they would not want this result in strings as well? |
||
return businessDates(start, end, true, true); | ||
} | ||
|
||
|
@@ -1357,14 +1359,16 @@ public LocalDate[] nonBusinessDates(final LocalDate start, final LocalDate end, | |
* @throws InvalidDateException if the dates are not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate[] nonBusinessDates(final String start, final String end, final boolean startInclusive, | ||
public String[] nonBusinessDates(final String start, final String end, final boolean startInclusive, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as the one on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assumed that String in implies String out. If someone is working in strings, do you expect that they would not want this result in strings as well? |
||
final boolean endInclusive) { | ||
if (start == null || end == null) { | ||
return null; | ||
} | ||
|
||
return nonBusinessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, | ||
endInclusive); | ||
final LocalDate[] dates = | ||
nonBusinessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, | ||
endInclusive); | ||
return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); | ||
} | ||
|
||
/** | ||
|
@@ -1430,7 +1434,7 @@ public LocalDate[] nonBusinessDates(final LocalDate start, final LocalDate end) | |
* @throws InvalidDateException if the dates are not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate[] nonBusinessDates(final String start, final String end) { | ||
public String[] nonBusinessDates(final String start, final String end) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as the one I made on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assumed that String in implies String out. If someone is working in strings, do you expect that they would not want this result in strings as well? |
||
return nonBusinessDates(start, end, true, true); | ||
} | ||
|
||
|
@@ -1748,12 +1752,13 @@ public LocalDate plusBusinessDays(final LocalDate date, final int days) { | |
* @throws InvalidDateException if the date is not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate plusBusinessDays(final String date, final int days) { | ||
public String plusBusinessDays(final String date, final int days) { | ||
if (date == null || days == NULL_INT) { | ||
return null; | ||
} | ||
|
||
return plusBusinessDays(DateTimeUtils.parseLocalDate(date), days); | ||
final LocalDate d = plusBusinessDays(DateTimeUtils.parseLocalDate(date), days); | ||
return d == null ? null : d.toString(); | ||
} | ||
|
||
/** | ||
|
@@ -1840,7 +1845,7 @@ public LocalDate minusBusinessDays(final LocalDate date, final int days) { | |
* @throws InvalidDateException if the date is not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate minusBusinessDays(final String date, final int days) { | ||
public String minusBusinessDays(final String date, final int days) { | ||
if (date == null || days == NULL_INT) { | ||
return null; | ||
} | ||
|
@@ -1939,12 +1944,13 @@ public LocalDate plusNonBusinessDays(final LocalDate date, final int days) { | |
* @throws InvalidDateException if the date is not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate plusNonBusinessDays(final String date, final int days) { | ||
public String plusNonBusinessDays(final String date, final int days) { | ||
if (date == null || days == NULL_INT) { | ||
return null; | ||
} | ||
|
||
return this.plusNonBusinessDays(DateTimeUtils.parseLocalDate(date), days); | ||
final LocalDate d = this.plusNonBusinessDays(DateTimeUtils.parseLocalDate(date), days); | ||
return d == null ? null : d.toString(); | ||
} | ||
|
||
/** | ||
|
@@ -2034,7 +2040,7 @@ public LocalDate minusNonBusinessDays(final LocalDate date, final int days) { | |
* @throws InvalidDateException if the date is not in the valid range | ||
* @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed | ||
*/ | ||
public LocalDate minusNonBusinessDays(final String date, final int days) { | ||
public String minusNonBusinessDays(final String date, final int days) { | ||
if (date == null || days == NULL_INT) { | ||
return null; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as on the other overload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed that String in implies String out. If someone is working in strings, do you expect that they would not want this result in strings as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
String in -> String out
,LocalDate in -> LocalDate out
is the most user-friendly