dce-reactkit 3.2.2-beta.14 → 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.14",
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",
@@ -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({