Skip to content

bug: calendar ignores IonicConfig.animated #30484

Open
@wouterverweirder

Description

@wouterverweirder

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

Switching between months in the calendar component is always happening with an animation, even if you have turned off animations in your application.

Expected Behavior

Switching to a month should happen without an animation.

Steps to Reproduce

  1. Disable animations on the root component or application
@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, IonicModule.forRoot({
    animated: false // Disable animations globally
  }), AppRoutingModule],
  providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
  bootstrap: [AppComponent],
})
  1. Add an component with a date presentation
<ion-datetime
  presentation="date"
  displayFormat="DD-MM-YYYY"
>
</ion-datetime>
  1. Switch between months. The new month slides in, even with animations turned off.

Code Reproduction URL

https://github.com/wouterverweirder/calendar-animation-bug

Ionic Info

Ionic:

Ionic CLI : 5.4.16 (/Users/wouter/.npm/_npx/864a9e3c2cd0cf50/node_modules/ionic)
Ionic Framework : not installed
@angular-devkit/build-angular : 19.2.15
@angular-devkit/schematics : 19.2.15
@angular/cli : 19.2.15
@ionic/angular-toolkit : 12.2.0

Capacitor:

Capacitor CLI : 7.3.0
@capacitor/core : 7.3.0

Utility:

cordova-res : not installed
native-run : 2.0.1

System:

NodeJS : v20.19.0 (/Users/wouter/.nvm/versions/node/v20.19.0/bin/node)
npm : 10.8.2
OS : macOS Unknown

Additional Information

Looks like the scrollTo code needs to be adjusted

calendarBodyRef.scrollTo({
top: 0,
left: left * (isRTL(this.el) ? -1 : 1),
behavior: 'smooth',
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions