tanclary commented on code in PR #3653:
URL: https://github.com/apache/calcite/pull/3653#discussion_r1468013258
##########
core/src/main/java/org/apache/calcite/util/format/FormatElementEnum.java:
##########
@@ -132,17 +133,41 @@ public enum FormatElementEnum implements FormatElement {
sb.append(String.format(Locale.ROOT, "%02d",
calendar.get(Calendar.HOUR_OF_DAY)));
}
},
+ ID("u", "The weekday (Monday as the first day of the week) as a decimal
number (1-7)") {
+ @Override public void format(StringBuilder sb, Date date) {
+ final Calendar calendar = Work.get().calendar;
+ calendar.setTime(date);
+ int weekDay = calendar.get(Calendar.DAY_OF_WEEK);
+ sb.append(String.format(Locale.ROOT, "%d", weekDay == 1 ? 7 : weekDay -
1));
Review Comment:
In my mind Calcite is complex enough that when we have opportunities to
explain little pieces of logic to reduce mental load for the developer, we
should
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]