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

Date and Time Updates: SimpleDateChooser allow both past and future, time picker #33

Closed
wants to merge 39 commits into from

Conversation

gabeabrams
Copy link
Contributor

No description provided.

Copy link
Contributor Author

@gabeabrams gabeabrams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments. Great work so far!

// Number of months to allow the user to choose from
// (max is 12, default is 6)
// Number of months in either the past or future to allow the user to choose from
// If we aren't allowing the past or the future, we will only show the present date
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, please throw an error (it doesn't make sense to have a chooser that only allows selecting one date).

// If true, instead of showing numMonthsToShow months into the future,
// show numMonthsToShow months into the past
chooseFromPast?: boolean,
// Determine if past dates are allowed to be chosen
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard language: If true, the user isn't allowed to select dates in the past

Same for below

endMonth += Math.max(0, numMonthsToShow - 1);
while (endMonth > 12) {
endMonth -= 12;
endYear += 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, endYear an unused variable. Is there a problem with the implementation? Or is this variable truly not needed?

// Calculate total number of months to show
let totalMonthsToShow = numMonthsToShow;
if (!dontAllowPast && !dontAllowFuture) {
totalMonthsToShow = totalMonthsToShow * 2;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with *=

for (let day = 1; day < today.day; day++) {
days.push(day);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing space

@@ -76,16 +80,36 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
days: number[],
year: number,
}[] = [];
// TODO: update logic to be able to generate either/or/and past + future
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this TODO? Isn't this the mission of the current work?

@gabeabrams gabeabrams force-pushed the f/date-and-time-updates branch from 5156d34 to 2ef2f44 Compare March 19, 2025 21:23
@gabeabrams gabeabrams closed this Apr 3, 2025
@gabeabrams gabeabrams deleted the f/date-and-time-updates branch April 3, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants