dce-reactkit 3.2.2-beta.13 → 3.2.2-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.13",
3
+ "version": "3.2.2-beta.15",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -876,13 +876,8 @@ const LogReviewer: React.FC<Props> = (props) => {
876
876
  day={dateFilterState.startDate.day}
877
877
  chooseFromPast
878
878
  onChange={(month, day, year) => {
879
- dispatch({
880
- type: ActionType.UpdateDateFilterState,
881
- dateFilterState: {
882
- ...dateFilterState,
883
- startDate: { month, day, year },
884
- },
885
- });
879
+ dateFilterState.startDate = { month, day, year };
880
+ handleDateRangeUpdated(dateFilterState);
886
881
  }}
887
882
  />
888
883
  {' '}
@@ -896,13 +891,8 @@ const LogReviewer: React.FC<Props> = (props) => {
896
891
  day={dateFilterState.endDate.day}
897
892
  chooseFromPast
898
893
  onChange={(month, day, year) => {
899
- dispatch({
900
- type: ActionType.UpdateDateFilterState,
901
- dateFilterState: {
902
- ...dateFilterState,
903
- endDate: { month, day, year },
904
- },
905
- });
894
+ dateFilterState.endDate = { month, day, year };
895
+ handleDateRangeUpdated(dateFilterState);
906
896
  }}
907
897
  />
908
898
  </TabBox>
@@ -111,13 +111,26 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
111
111
  // Figure out which days are allowed
112
112
  const days = [];
113
113
  const numDaysInMonth = (new Date(year, month, 0)).getDate();
114
- const firstDay = (
115
- month === today.month
116
- ? today.day // Current month: start at current date
117
- : 1 // Future month: start at beginning of month
118
- );
119
- for (let day = firstDay; day <= numDaysInMonth; day++) {
120
- days.push(day);
114
+ if (chooseFromPast) {
115
+ // Past selection
116
+ const numDaysToAdd = (
117
+ (month === today.month)
118
+ ? today.day // Current month, only add up to today
119
+ : numDaysInMonth // Past month, add all days
120
+ );
121
+ for (let day = 1; day <= numDaysToAdd; day++) {
122
+ days.push(day);
123
+ }
124
+ } else {
125
+ // Future selection: add all remaining days of the month
126
+ const firstDay = (
127
+ month === today.month
128
+ ? today.day // Current month: start at current date
129
+ : 1 // Future month: start at beginning of month
130
+ );
131
+ for (let day = firstDay; day <= numDaysInMonth; day++) {
132
+ days.push(day);
133
+ }
121
134
  }
122
135
 
123
136
  choices.push({