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

Fix: default time selection #4552

Merged
merged 4 commits into from
Mar 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@
endDate,
selectsMultiple,
selectedDates,
minTime,
} = this.props;

if (
Expand All @@ -655,6 +656,18 @@
second: getSeconds(this.props.selected),
});
}

// If minTime is present then set the time to minTime
if (this.props.showTimeSelect || this.props.showTimeSelectOnly) {
if (minTime) {
changedDate = setTime(changedDate, {

Check warning on line 663 in src/index.jsx

View check run for this annotation

Codecov / codecov/patch

src/index.jsx#L663

Added line #L663 was not covered by tests
hour: minTime.getHours(),
minute: minTime.getMinutes(),
second: minTime.getSeconds(),
});
}
}

if (!this.props.inline) {
this.setState({
preSelection: changedDate,
Expand Down
Loading