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/dist/cjs/index.js +19 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +19 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SimpleDateChooser.tsx +20 -7
package/package.json
CHANGED
|
@@ -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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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({
|