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

feat(datetime): add animation to adjacent days selection #30298

Merged
merged 12 commits into from
Mar 28, 2025
3 changes: 2 additions & 1 deletion core/src/components/datetime/datetime.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@
* is selected should have ion-color for
* text color and be bolder.
*/
:host .calendar-day.calendar-day-active {
:host .calendar-day.calendar-day-active,
:host .calendar-day.calendar-day-adjacent-day.calendar-day-active {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:host .calendar-day.calendar-day-adjacent-day.calendar-day-active {
:host .calendar-day.calendar-day-adjacent-day.calendar-day-active {

color: current-color(base);

font-weight: 600;
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/datetime/datetime.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
* is selected should have ion-color for
* text color and be bolder.
*/
:host .calendar-day.calendar-day-active {
:host .calendar-day.calendar-day-active,
:host .calendar-day.calendar-day-adjacent-day.calendar-day-active{
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:host .calendar-day.calendar-day-adjacent-day.calendar-day-active{
:host .calendar-day.calendar-day-adjacent-day.calendar-day-active {

color: current-color(contrast);
}

Expand Down
11 changes: 6 additions & 5 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2380,11 +2380,6 @@ export class Datetime implements ComponentInterface {
return;
}

if (isAdjacentDay) {
// The user selected a day outside the current month. Ignore this button, as the month will be re-rendered.
this.el.blur();
}

this.setWorkingParts({
...this.workingParts,
month: _month,
Expand All @@ -2393,6 +2388,12 @@ export class Datetime implements ComponentInterface {
isAdjacentDay,
});

if (isAdjacentDay) {
// The user selected a day outside the current month. Ignore this button, as the month will be re-rendered.
this.el.blur();
this.animateToDate(this.workingParts);
}

// multiple only needs date info, so we can wipe out other fields like time
if (multiple) {
this.setActiveParts(
Expand Down
Loading