Skip to content
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 cleanup #4201

Merged
merged 155 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
ec5f461
First refactoring.
chipkent Jun 27, 2023
756dbac
First refactoring.
chipkent Jun 27, 2023
eb583ec
Add local date chronology methods.
chipkent Jun 27, 2023
0bd59cf
Calendar refactoring and cleanup.
chipkent Jun 27, 2023
3afab43
Calendar refactoring and cleanup.
chipkent Jun 27, 2023
527cb3a
Calendar refactoring and cleanup.
chipkent Jun 27, 2023
475d8f8
Calendar refactoring and cleanup.
chipkent Jun 28, 2023
fabbe4a
BusinessCalendar refactoring and cleanup.
chipkent Jul 1, 2023
ca2040d
BusinessCalendar refactoring and cleanup.
chipkent Jul 1, 2023
b334e22
BusinessPeriod BusinessSchedule refactoring and cleanup.
chipkent Jul 2, 2023
91cc545
BusinessCalendar refactoring and cleanup:
chipkent Jul 2, 2023
185a014
BusinessCalendar refactoring and cleanup:
chipkent Jul 4, 2023
82d04be
BusinessCalendar refactoring and cleanup:
chipkent Jul 4, 2023
83e3b9d
BusinessCalendar refactoring and cleanup:
chipkent Jul 4, 2023
9bade1c
BusinessCalendar refactoring and cleanup:
chipkent Jul 5, 2023
611a2ec
BusinessCalendar refactoring and cleanup:
chipkent Jul 5, 2023
720df95
BusinessCalendar refactoring and cleanup:
chipkent Jul 7, 2023
14fb234
BusinessCalendar refactoring and cleanup:
chipkent Jul 7, 2023
591b8fe
BusinessCalendar refactoring and cleanup:
chipkent Jul 7, 2023
e0f5d2c
BusinessCalendar refactoring and cleanup:
chipkent Jul 7, 2023
ce255f9
BusinessCalendar refactoring and cleanup:
chipkent Jul 7, 2023
0175576
BusinessCalendar refactoring and cleanup:
chipkent Jul 7, 2023
decb87b
BusinessCalendar refactoring and cleanup:
chipkent Jul 10, 2023
6fa4077
BusinessCalendar refactoring and cleanup:
chipkent Jul 11, 2023
3af05d3
Calendar refactoring and cleanup:
chipkent Jul 11, 2023
f92b1f2
DateTimeUtils added todayDate plus formatting LocalDate.
chipkent Jul 11, 2023
d1147bd
Todo cleanup:
chipkent Jul 11, 2023
cb5b667
Todo and docs cleanup:
chipkent Jul 11, 2023
2d15d11
Todo and docs and formatting cleanup:
chipkent Jul 11, 2023
860f615
Todo and docs and formatting cleanup:
chipkent Jul 11, 2023
cbf6461
Todo and docs and formatting cleanup:
chipkent Jul 11, 2023
124de3e
Todo and docs and formatting cleanup:
chipkent Jul 11, 2023
55e1dec
Unit test:
chipkent Jul 11, 2023
6b9d0b2
Unit test:
chipkent Jul 11, 2023
1c46647
Unit test:
chipkent Jul 11, 2023
14ee357
Unit test:
chipkent Jul 12, 2023
4cc5066
Unit test:
chipkent Jul 12, 2023
c50eb37
Unit test:
chipkent Jul 12, 2023
d875692
Unit test:
chipkent Jul 12, 2023
6aefb0d
Unit test:
chipkent Jul 12, 2023
d92f6c5
Unit test:
chipkent Jul 17, 2023
03eda36
Unit test:
chipkent Jul 17, 2023
f1bc1be
Unit test:
chipkent Jul 17, 2023
54b0d65
Unit test:
chipkent Jul 17, 2023
c4b67fd
Committing to rebase
chipkent Jul 17, 2023
c3536ef
Merge remote-tracking branch 'origin/main' into cal_upgrades
chipkent Jul 17, 2023
fdaef8d
Committing to rebase
chipkent Jul 18, 2023
e4eedf6
Rebase
chipkent Oct 30, 2023
a4d9605
Updated doc string.
chipkent Oct 30, 2023
f9c190c
Updated doc string. Added a weekendDays getter.
chipkent Oct 31, 2023
c61aa38
Updated doc string. Added a weekendDays getter.
chipkent Oct 31, 2023
ae26972
Renamed todayDate to todayLocalDate. (partial commit)
chipkent Oct 31, 2023
54c44de
Add LocalDate arithmetic.
chipkent Oct 31, 2023
6cd75fb
Updating calendar configs.
chipkent Oct 31, 2023
6fd7e2f
Updating calendar configs.
chipkent Oct 31, 2023
849fe1c
Refactoring code gen
chipkent Nov 1, 2023
582d4bd
Refactoring code gen
chipkent Nov 1, 2023
27dd6a8
Make axis transforms compile
chipkent Nov 1, 2023
986ad6b
Refactoring code gen. Not fully working.
chipkent Nov 1, 2023
7631d13
Updated GroovyStaticImports
chipkent Nov 3, 2023
7d915b6
Refactoring code gen. Not fully working.
chipkent Nov 3, 2023
15fc1f9
Figure interface
chipkent Nov 3, 2023
dc5324a
Figure interface
chipkent Nov 3, 2023
6e8740f
FigureImpl
chipkent Nov 3, 2023
37610de
Refactoring code gen.
chipkent Nov 3, 2023
e762d1b
Refactoring code gen.
chipkent Nov 3, 2023
b941cad
Refactoring code gen.
chipkent Nov 3, 2023
9bb1c7b
Refactoring code gen.
chipkent Nov 3, 2023
74e4e2c
Refactoring code gen.
chipkent Nov 3, 2023
37fb493
Refactoring code gen.
chipkent Nov 3, 2023
64f1799
StaticCalendarMethods
chipkent Nov 3, 2023
f4d238d
Refactoring code gen.
chipkent Nov 3, 2023
c443bce
Renamed currentDate to calendarDate
chipkent Nov 3, 2023
51beefd
Add calendar methods to groovy.
chipkent Nov 3, 2023
18464d2
Add calendar methods to ColumnExpressionValidator.
chipkent Nov 3, 2023
bee8f33
Working on tests.
chipkent Nov 3, 2023
eb03694
Working on tests.
chipkent Nov 3, 2023
31d3175
StaticCalendarMethods
chipkent Nov 3, 2023
c5c199b
Spotless
chipkent Nov 3, 2023
162800b
Update calendar files
chipkent Nov 6, 2023
2c4567f
Addressing tests.
chipkent Nov 6, 2023
7514c06
Automatically test all static calendar methods in query strings and a…
chipkent Nov 6, 2023
1363c94
Improve test coverage.
chipkent Nov 6, 2023
b480afb
Improve test coverage.
chipkent Nov 6, 2023
edc39e0
spotless
chipkent Nov 6, 2023
6a2a20d
Python API and unit tests.
chipkent Nov 7, 2023
41901fc
Spotless
chipkent Nov 7, 2023
13ebbc5
Create a numpy business calendar.
chipkent Nov 7, 2023
8bfe4b3
Create a BusinessCalendar dtype.
chipkent Nov 7, 2023
8dfd527
Merge remote-tracking branch 'origin/main' into cal_upgrades
chipkent Nov 7, 2023
82e30d5
Fixed figure.py
chipkent Nov 7, 2023
8e51976
Fixed unit tests
chipkent Nov 8, 2023
b9cd139
Fixed unit tests
chipkent Nov 8, 2023
f2d4167
Fixed unit tests
chipkent Nov 8, 2023
e30d23d
Addressing code review.
chipkent Nov 20, 2023
70dd8cb
Addressing code review.
chipkent Nov 20, 2023
26bc1c4
Addressing code review.
chipkent Nov 20, 2023
796651c
Addressing code review.
chipkent Nov 20, 2023
bfa59f8
Addressing code review.
chipkent Nov 20, 2023
f048fae
Elijah's updated calendars, only from authoritative sources.
chipkent Nov 20, 2023
82aaf0f
Spotless
chipkent Nov 20, 2023
4eff978
Reduce logging level.
chipkent Nov 21, 2023
a69a047
Function rename
chipkent Nov 21, 2023
76f83cd
Function/Class rename
chipkent Nov 21, 2023
c5bcf1d
Addressing review comments.
chipkent Nov 21, 2023
a666d3b
Fixed broken unit test.
chipkent Nov 21, 2023
90b6544
Added a new calendar integration test and fix test failures.
chipkent Nov 21, 2023
252b305
Test numpy calendars with a bus calendar with no business time.
chipkent Nov 21, 2023
438bf02
Update engine/time/src/main/java/io/deephaven/time/calendar/BusinessC…
chipkent Nov 29, 2023
e79c062
Update engine/time/src/main/java/io/deephaven/time/calendar/BusinessD…
chipkent Nov 29, 2023
fdba4f9
Update engine/time/src/main/java/io/deephaven/time/calendar/BusinessC…
chipkent Nov 29, 2023
35b43ca
Update py/server/deephaven/calendar.py
chipkent Nov 29, 2023
5dcdec8
Update py/server/deephaven/calendar.py
chipkent Nov 29, 2023
39be342
Address review comments.
chipkent Nov 29, 2023
f77e453
Address review comments.
chipkent Nov 29, 2023
993f9f6
Address review comments.
chipkent Nov 29, 2023
dc63eca
Address review comments.
chipkent Nov 29, 2023
4fa5585
Address review comments.
chipkent Nov 29, 2023
b7c0615
Address review comments.
chipkent Nov 29, 2023
97ecf95
Address review comments.
chipkent Nov 29, 2023
6350f86
Address review comments.
chipkent Nov 29, 2023
34da67a
Address review comments.
chipkent Nov 29, 2023
c59271c
Address review comments. Name changes.
chipkent Dec 5, 2023
4475018
Address review comments. Name changes.
chipkent Dec 5, 2023
6c87ed0
Address review comments. Regenerate and format.
chipkent Dec 5, 2023
ef4d833
Address review comments. Regenerate and format.
chipkent Dec 5, 2023
ba73e33
Address review comments. Improve multi-threaded performance.
chipkent Dec 5, 2023
f972cb5
Address review comments. Corrected sources list.
chipkent Dec 5, 2023
6e83ad0
Address review comments. Improved documentation.
chipkent Dec 5, 2023
0f08c74
Address review comments. Compute time range nanos on demand and supp…
chipkent Dec 6, 2023
282e6ea
Address review comments. More explicitly handle open vs closed ranges.
chipkent Dec 6, 2023
f5b355c
Address review comments. More explicitly handle open vs closed ranges.
chipkent Dec 6, 2023
d5e7e23
Address review comments. Update calendar parsing for 24:00.
chipkent Dec 6, 2023
bfb96fb
Spotless
chipkent Dec 6, 2023
f25ebce
Addressing review comments. Add methods that return durations.
chipkent Dec 6, 2023
2665407
Addressing review comments. Add methods that return durations.
chipkent Dec 6, 2023
3669b5e
Fixed error message.
chipkent Dec 11, 2023
7aad38a
Addressing reviewer comments. Making the calendar API null tolerant,…
chipkent Dec 11, 2023
547d7a6
Addressing review comments. Make the entire API null tolerant for co…
chipkent Dec 12, 2023
1a2e925
Addressing review comments. Defer calendar initialization to make fi…
chipkent Dec 12, 2023
b59a737
Spotless
chipkent Dec 12, 2023
789b826
Address review comments. Rename DateTimeUtils.plus to DateTimeUtils.…
chipkent Dec 12, 2023
1ffdb7d
Update py/server/deephaven/calendar.py
chipkent Dec 13, 2023
1297b99
Address review comments. Rename DateTimeUtils.minus to DateTimeUtils…
chipkent Dec 15, 2023
40d2a6c
Merge remote-tracking branch 'origin/cal_upgrades' into cal_upgrades
chipkent Dec 15, 2023
1f5d28d
Address review comments. Docstring cleanup.
chipkent Dec 15, 2023
787b646
Address review comments. BusinessCalendarXMLParser not public.
chipkent Dec 15, 2023
a007d3f
Address review comments. Made BusinessCalendar and Calendar construc…
chipkent Dec 15, 2023
a0618b3
Address review comments. Shrink the UTC calendar to save memory.
chipkent Dec 15, 2023
48a4a13
Address review comments. Rename dayOfWeek to dayOfWeekValue and add …
chipkent Dec 15, 2023
91d0168
Address review comments. Compromise on publishing business calendars…
chipkent Dec 15, 2023
ec5a419
Address review comments. Fix javadocs.
chipkent Dec 15, 2023
6131056
Rebase
chipkent Dec 15, 2023
2133a93
Address review comments. Spotless
chipkent Dec 15, 2023
81aca2a
Python unit test fixes.
chipkent Dec 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public static void main(String[] args) throws ClassNotFoundException, IOExceptio
(s) -> {
if (s.equals("dayOfWeek")) {
return "calendarDayOfWeek";
} else if (s.equals("dayOfWeekValue")) {
return "calendarDayOfWeekValue";
} else if (s.equals("timeZone")) {
return "calendarTimeZone";
} else {
Expand Down
56 changes: 51 additions & 5 deletions engine/time/src/main/java/io/deephaven/time/DateTimeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ public static ZonedDateTime plus(@Nullable final ZonedDateTime dateTime, @Nullab
*/
@ScriptApi
@Nullable
public static LocalDate minus(@Nullable final LocalDate date, final long days) {
public static LocalDate minusDays(@Nullable final LocalDate date, final long days) {
if (date == null || days == NULL_LONG) {
return null;
}
Expand Down Expand Up @@ -2751,6 +2751,52 @@ public static int hourOfDay(@Nullable final ZonedDateTime dateTime) {
return minuteOfDay(dateTime) / 60;
}

/**
* Returns athe day of the week for a {@link ZonedDateTime} in the specified time zone.
*
* @param date date to find the day of the week of
* @return {@code null} if either input is {@code null}; otherwise, the day of the week
*/
@ScriptApi
public static DayOfWeek dayOfWeek(@Nullable final LocalDate date) {
if (date == null) {
return null;
}

return date.getDayOfWeek();
}

/**
* Returns the day of the week for an {@link Instant} in the specified time zone.
*
* @param instant time to find the day of the week of
* @param timeZone time zone
* @return {@code null} if either input is {@code null}; otherwise, the day of the week
*/
@ScriptApi
public static DayOfWeek dayOfWeek(@Nullable final Instant instant, @Nullable final ZoneId timeZone) {
if (instant == null || timeZone == null) {
return null;
}

return dayOfWeek(toZonedDateTime(instant, timeZone));
}

/**
* Returns the day of the week for a {@link ZonedDateTime} in the specified time zone.
*
* @param dateTime time to find the day of the week of
* @return {@code null} if either input is {@code null}; otherwise, the day of the week
*/
@ScriptApi
public static DayOfWeek dayOfWeek(@Nullable final ZonedDateTime dateTime) {
if (dateTime == null) {
return null;
}

return dateTime.getDayOfWeek();
}

/**
* Returns a 1-based int value of the day of the week for a {@link ZonedDateTime} in the specified time zone, with 1
* being Monday and 7 being Sunday.
Expand All @@ -2759,7 +2805,7 @@ public static int hourOfDay(@Nullable final ZonedDateTime dateTime) {
* @return {@link QueryConstants#NULL_INT} if either input is {@code null}; otherwise, the day of the week
*/
@ScriptApi
public static int dayOfWeek(@Nullable final LocalDate date) {
public static int dayOfWeekValue(@Nullable final LocalDate date) {
if (date == null) {
return io.deephaven.util.QueryConstants.NULL_INT;
}
Expand All @@ -2776,12 +2822,12 @@ public static int dayOfWeek(@Nullable final LocalDate date) {
* @return {@link QueryConstants#NULL_INT} if either input is {@code null}; otherwise, the day of the week
*/
@ScriptApi
public static int dayOfWeek(@Nullable final Instant instant, @Nullable final ZoneId timeZone) {
public static int dayOfWeekValue(@Nullable final Instant instant, @Nullable final ZoneId timeZone) {
if (instant == null || timeZone == null) {
return NULL_INT;
}

return dayOfWeek(toZonedDateTime(instant, timeZone));
return dayOfWeekValue(toZonedDateTime(instant, timeZone));
}

/**
Expand All @@ -2792,7 +2838,7 @@ public static int dayOfWeek(@Nullable final Instant instant, @Nullable final Zon
* @return {@link QueryConstants#NULL_INT} if either input is {@code null}; otherwise, the day of the week
*/
@ScriptApi
public static int dayOfWeek(@Nullable final ZonedDateTime dateTime) {
public static int dayOfWeekValue(@Nullable final ZonedDateTime dateTime) {
if (dateTime == null) {
return NULL_INT;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private YearData getYearData(final int year) {
* is different from the schedule for a standard business day or weekend.
* @throws RequirementFailure if any argument is null.
*/
public BusinessCalendar(final String name, final String description, final ZoneId timeZone,
BusinessCalendar(final String name, final String description, final ZoneId timeZone,
final LocalDate firstValidDate, final LocalDate lastValidDate,
final CalendarDay<LocalTime> standardBusinessDay, final Set<DayOfWeek> weekendDays,
final Map<LocalDate, CalendarDay<Instant>> holidays) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* }
* </pre>
*/
public class BusinessCalendarXMLParser {
class BusinessCalendarXMLParser {

private static class BusinessCalendarInputs {
private String calendarName;
Expand Down
107 changes: 83 additions & 24 deletions engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import io.deephaven.base.verify.RequirementFailure;
import io.deephaven.time.DateTimeUtils;

import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -22,8 +19,9 @@
* <p>
* A calendar is associated with a specific time zone.
* <p>
* Date strings must be in a format that can be parsed by {@code DateTimeUtils#parseDate}. Methods that accept strings
* can be slower than methods written explicitly for {@code Instant}, {@code ZonedDateTime}, or {@code LocalDate}.
* Date strings must be in a format that can be parsed by {@link DateTimeUtils#parseLocalDate(String)}. Methods that
* accept strings can be slower than methods written explicitly for {@code Instant}, {@code ZonedDateTime}, or
* {@code LocalDate}.
*/
public class Calendar {

Expand All @@ -41,7 +39,7 @@ public class Calendar {
* @param timeZone calendar time zone.
* @throws RequirementFailure if any parameter is {@code null}
*/
public Calendar(final String name, final String description, final ZoneId timeZone) {
Calendar(final String name, final String description, final ZoneId timeZone) {
this.name = Require.neqNull(name, "name");
this.description = Require.neqNull(description, "description");
this.timeZone = Require.neqNull(timeZone, "timeZone");
Expand Down Expand Up @@ -105,68 +103,129 @@ public LocalDate calendarDate() {
*
* @return current day of the week
*/
public int dayOfWeek() {
public DayOfWeek dayOfWeek() {
return dayOfWeek(calendarDate());
}

/**
* The current day of the week for the calendar.
*
* @param date date
* @return current day of the week, or {@code null} if the input is {@code null}.
*/
public DayOfWeek dayOfWeek(final LocalDate date) {
return DateTimeUtils.dayOfWeek(date);
}

/**
* The current day of the week for the calendar.
*
* @param date date
* @return current day of the week, or {@code null} if the input is {@code null}.
*/
public DayOfWeek dayOfWeek(final String date) {
if (date == null) {
return null;
}

return DateTimeUtils.dayOfWeek(DateTimeUtils.parseLocalDate(date));
}

/**
* The current day of the week for the calendar.
*
* @param time time
* @return current day of the week, or {@code null} if the input is {@code null}.
*/
public DayOfWeek dayOfWeek(final Instant time) {
if (time == null) {
return null;
}

return DateTimeUtils.dayOfWeek(time, timeZone);
}

/**
* The current day of the week for the calendar.
*
* @param time time
* @return current day of the week, or {@code null} if the input is {@code null}.
*/
public DayOfWeek dayOfWeek(final ZonedDateTime time) {
if (time == null) {
return null;
}

return DateTimeUtils.dayOfWeek(time.toInstant(), timeZone);
}

/**
* Returns a 1-based int value of the day of the week for the calendar, where 1 is Monday and 7 is Sunday.
*
* @return current day of the week
*/
public int dayOfWeekValue() {
return dayOfWeekValue(calendarDate());
}

/**
* Returns a 1-based int value of the day of the week for the calendar, where 1 is Monday and 7 is Sunday.
*
* @param date date
* @return current day of the week, or {@link io.deephaven.util.QueryConstants#NULL_INT} if the input is
* {@code null}.
*/
public int dayOfWeek(final LocalDate date) {
public int dayOfWeekValue(final LocalDate date) {
if (date == null) {
return NULL_INT;
}

return DateTimeUtils.dayOfWeek(date);
return DateTimeUtils.dayOfWeekValue(date);
}

/**
* The current day of the week for the calendar.
* Returns a 1-based int value of the day of the week for the calendar, where 1 is Monday and 7 is Sunday.
*
* @param date date
* @return current day of the week, or {@link io.deephaven.util.QueryConstants#NULL_INT} if the input is
* {@code null}.
*/
public int dayOfWeek(final String date) {
public int dayOfWeekValue(final String date) {
if (date == null) {
return NULL_INT;
}

return DateTimeUtils.dayOfWeek(DateTimeUtils.parseLocalDate(date));
return DateTimeUtils.dayOfWeekValue(DateTimeUtils.parseLocalDate(date));
}

/**
* The current day of the week for the calendar.
* Returns a 1-based int value of the day of the week for the calendar, where 1 is Monday and 7 is Sunday.
*
* @param time time
* @return current day of the week, or {@link io.deephaven.util.QueryConstants#NULL_INT} if the input is
* {@code null}.
*/
public int dayOfWeek(final Instant time) {
public int dayOfWeekValue(final Instant time) {
if (time == null) {
return NULL_INT;
}

return DateTimeUtils.dayOfWeek(time, timeZone);
return DateTimeUtils.dayOfWeekValue(time, timeZone);
}

/**
* The current day of the week for the calendar.
* Returns a 1-based int value of the day of the week for the calendar, where 1 is Monday and 7 is Sunday.
*
* @param time time
* @return current day of the week, or {@link io.deephaven.util.QueryConstants#NULL_INT} if the input is
* {@code null}.
*/
public int dayOfWeek(final ZonedDateTime time) {
public int dayOfWeekValue(final ZonedDateTime time) {
if (time == null) {
return NULL_INT;
}

return DateTimeUtils.dayOfWeek(time.toInstant(), timeZone);
return DateTimeUtils.dayOfWeekValue(time.toInstant(), timeZone);
}

// endregion
Expand Down Expand Up @@ -209,7 +268,7 @@ public LocalDate plusDays(final String date, final int days) {

/**
* Adds a specified number of days to an input time. Adding negative days is equivalent to subtracting days.
*
* <p>
* Day additions are not always 24 hours. The resultant time will have the same local time as the input time, as
* determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a
* daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which
Expand All @@ -230,7 +289,7 @@ public Instant plusDays(final Instant time, final int days) {

/**
* Adds a specified number of days to an input time. Adding negative days is equivalent to subtracting days.
*
* <p>
* Day additions are not always 24 hours. The resultant time will have the same local time as the input time, as
* determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a
* daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which
Expand Down Expand Up @@ -290,7 +349,7 @@ public LocalDate minusDays(final String date, final int days) {

/**
* Subtracts a specified number of days to an input time. Subtracting negative days is equivalent to adding days.
*
* <p>
* Day subtractions are not always 24 hours. The resultant time will have the same local time as the input time, as
* determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a
* daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which
Expand All @@ -311,12 +370,12 @@ public Instant minusDays(final Instant time, final int days) {

/**
* Subtracts a specified number of days to an input time. Subtracting negative days is equivalent to adding days.
*
* <p>
* Day subtractions are not always 24 hours. The resultant time will have the same local time as the input time, as
* determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a
* daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which
* is a 25-hour difference.
*
* <p>
* The resultant time will have the same time zone as the calendar. This could be different than the time zone of
* the input {@link ZonedDateTime}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Schedule for a single calendar day. The schedule contains a list of business time ranges, which are the ranges of
* time during which businesses are open.
*
* <p>
* A business day may contain multiple business time ranges. For example, some financial exchanges have a morning and an
* afternoon trading session. This would be represented by a business day with two business time ranges.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,34 @@ public class StaticCalendarMethods {
public static io.deephaven.time.calendar.CalendarDay<java.time.Instant> calendarDay( java.time.ZonedDateTime time ) {return Calendars.calendar().calendarDay( time );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeek() */
public static int calendarDayOfWeek( ) {return Calendars.calendar().dayOfWeek( );}
public static java.time.DayOfWeek calendarDayOfWeek( ) {return Calendars.calendar().dayOfWeek( );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeek(java.lang.String) */
public static int calendarDayOfWeek( java.lang.String date ) {return Calendars.calendar().dayOfWeek( date );}
public static java.time.DayOfWeek calendarDayOfWeek( java.lang.String date ) {return Calendars.calendar().dayOfWeek( date );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeek(java.time.Instant) */
public static int calendarDayOfWeek( java.time.Instant time ) {return Calendars.calendar().dayOfWeek( time );}
public static java.time.DayOfWeek calendarDayOfWeek( java.time.Instant time ) {return Calendars.calendar().dayOfWeek( time );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeek(java.time.LocalDate) */
public static int calendarDayOfWeek( java.time.LocalDate date ) {return Calendars.calendar().dayOfWeek( date );}
public static java.time.DayOfWeek calendarDayOfWeek( java.time.LocalDate date ) {return Calendars.calendar().dayOfWeek( date );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeek(java.time.ZonedDateTime) */
public static int calendarDayOfWeek( java.time.ZonedDateTime time ) {return Calendars.calendar().dayOfWeek( time );}
public static java.time.DayOfWeek calendarDayOfWeek( java.time.ZonedDateTime time ) {return Calendars.calendar().dayOfWeek( time );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeekValue() */
public static int calendarDayOfWeekValue( ) {return Calendars.calendar().dayOfWeekValue( );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeekValue(java.lang.String) */
public static int calendarDayOfWeekValue( java.lang.String date ) {return Calendars.calendar().dayOfWeekValue( date );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeekValue(java.time.Instant) */
public static int calendarDayOfWeekValue( java.time.Instant time ) {return Calendars.calendar().dayOfWeekValue( time );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeekValue(java.time.LocalDate) */
public static int calendarDayOfWeekValue( java.time.LocalDate date ) {return Calendars.calendar().dayOfWeekValue( date );}

/** @see io.deephaven.time.calendar.Calendar#dayOfWeekValue(java.time.ZonedDateTime) */
public static int calendarDayOfWeekValue( java.time.ZonedDateTime time ) {return Calendars.calendar().dayOfWeekValue( time );}

/** @see io.deephaven.time.calendar.BusinessCalendar#diffBusinessDays(java.time.Instant,java.time.Instant) */
public static double diffBusinessDays( java.time.Instant start, java.time.Instant end ) {return Calendars.calendar().diffBusinessDays( start, end );}
Expand Down
Loading