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/esm/index.js CHANGED
@@ -1357,12 +1357,25 @@ const SimpleDateChooser = (props) => {
1357
1357
  // Figure out which days are allowed
1358
1358
  const days = [];
1359
1359
  const numDaysInMonth = (new Date(year, month, 0)).getDate();
1360
- const firstDay = (month === today.month
1361
- ? today.day // Current month: start at current date
1362
- : 1 // Future month: start at beginning of month
1363
- );
1364
- for (let day = firstDay; day <= numDaysInMonth; day++) {
1365
- days.push(day);
1360
+ if (chooseFromPast) {
1361
+ // Past selection
1362
+ const numDaysToAdd = ((month === today.month)
1363
+ ? today.day // Current month, only add up to today
1364
+ : numDaysInMonth // Past month, add all days
1365
+ );
1366
+ for (let day = 1; day <= numDaysToAdd; day++) {
1367
+ days.push(day);
1368
+ }
1369
+ }
1370
+ else {
1371
+ // Future selection: add all remaining days of the month
1372
+ const firstDay = (month === today.month
1373
+ ? today.day // Current month: start at current date
1374
+ : 1 // Future month: start at beginning of month
1375
+ );
1376
+ for (let day = firstDay; day <= numDaysInMonth; day++) {
1377
+ days.push(day);
1378
+ }
1366
1379
  }
1367
1380
  choices.push({
1368
1381
  choiceName: `${monthName} ${year}`,