code: private void formatWeekdayNumeric(StringBuilder b, ZonedDateTime d, int firstDay) {
      // Java returns ISO-8601 where Monday = 1 and Sunday = 7.
      int weekday = d.getDayOfWeek().getValue();
  
      // Adjust to the localized "first day of the week"
      int w = (7 - firstDay + weekday) % 7 + 1;
      b.append(w);
    }
docs: Convert from Java's ISO-8601 week number, where Monday = 1 and Sunday = 7.
  We need to adjust this according to the locale's "first day of the week" which
  in the US is Sunday = 0.
  
  In the US, Tuesday will produce '3' or the 3rd day of the week:
  
  weekday = 2  (ISO-8601 Tuesday == 2)
  int w = (7 - 0 + weekday) % 7 + 1
  w == 3
  
  In the US, Saturday will produce '7', ending the week:
  
  weekday = 6  (ISO-8601 Saturday == 6)
  int w = (7 - 0 + weekday) % 7 + 1
  w == 7