# How to exclude weekends in Ion-DateTime component

**URL:** <https://forum.ionicframework.com/t/how-to-exclude-weekends-in-ion-datetime-component/221665>\
**Category:** Ionic Angular\
**Created:** [March 23, 2022, 2:36pm UTC](https://forum.ionicframework.com/t/how-to-exclude-weekends-in-ion-datetime-component/221665 "2022-03-23T14:36:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![billooTest](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@billooTest](https://forum.ionicframework.com/u/billooTest)\
**Post date:** [March 23, 2022, 2:36pm UTC](https://forum.ionicframework.com/t/how-to-exclude-weekends-in-ion-datetime-component/221665/1 "2022-03-23T14:36:56Z")

</div>

Hello everyone, I need to exclude weekends from my dateTime. How can I do this?  
Thanks a lot to everyone

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [March 23, 2022, 5:09pm UTC](https://forum.ionicframework.com/t/how-to-exclude-weekends-in-ion-datetime-component/221665/2 "2022-03-23T17:09:37Z")

</div>

Wait for Version `6.1` 😏 They added this great feature, see pr: [feat(datetime): isDateEnabled to enable/disable specific days by sean-perkins · Pull Request #24898 · ionic-team/ionic-framework · GitHub](https://github.com/ionic-team/ionic-framework/pull/24898)

---

<div class="post-metadata">

**Author:** ![jhonalbert48](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jhonalbert48/32/140873_2.png) [@jhonalbert48](https://forum.ionicframework.com/u/jhonalbert48)\
**Post date:** [March 24, 2022, 10:38am UTC](https://forum.ionicframework.com/t/how-to-exclude-weekends-in-ion-datetime-component/221665/3 "2022-03-24T10:38:09Z")

</div>

```auto
<mat-form-field class="example-full-width" appearance="fill">
  <mat-label>Choose a date</mat-label>
  <input matInput [matDatepickerFilter]="myFilter" [matDatepicker]="picker">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #picker></mat-datepicker>
</mat-form-field>

```

```auto
 myFilter = (d: Date | null): boolean => {
    const day = (d || new Date()).getDay();
    // Prevent Saturday and Sunday from being selected.
    return day !== 0 && day !== 6;
  }

```
