forked from valor-software/ngx-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datepicker): Add support to set custom classes on specific dates
Closes valor-software#3958
- Loading branch information
Martin Troedsson
committed
Jan 31, 2019
1 parent
4c8f373
commit 68bcd9a
Showing
20 changed files
with
228 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
demo/src/app/components/+datepicker/demos/date-custom-classes/date-custom-classes.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="row"> | ||
<div class="col-xs-12 col-12 col-sm-6 col-md-4 form-group"> | ||
<input class="form-control" | ||
placeholder="Datepicker" | ||
ngModel | ||
bsDatepicker | ||
[dateCustomClasses]="dateCustomClasses"> | ||
</div> | ||
<div class="col-xs-12 col-12 col-sm-6 col-md-4 form-group"> | ||
<input class="form-control" | ||
placeholder="Daterangepicker" | ||
ngModel | ||
bsDaterangepicker | ||
[dateCustomClasses]="dateCustomClasses"> | ||
</div> | ||
</div> | ||
|
||
|
24 changes: 24 additions & 0 deletions
24
demo/src/app/components/+datepicker/demos/date-custom-classes/date-custom-classes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Component } from '@angular/core'; | ||
import { BsDatepickerDateCustomClasses } from 'ngx-bootstrap/datepicker'; | ||
|
||
@Component({ | ||
selector: 'demo-datepicker-date-custom-classes', | ||
templateUrl: './date-custom-classes.html' | ||
}) | ||
export class DemoDatepickerDateCustomClassesComponent { | ||
dateCustomClasses: BsDatepickerDateCustomClasses[]; | ||
|
||
constructor() { | ||
let now = new Date(); | ||
let twoDaysAhead = new Date(); | ||
twoDaysAhead.setDate(now.getDate() + 2); | ||
let fourDaysAhead = new Date(); | ||
fourDaysAhead.setDate(now.getDate() + 4); | ||
|
||
this.dateCustomClasses = [ | ||
{ date: now, classes: [] }, | ||
{ date: twoDaysAhead, classes: ['bg-warning'] }, | ||
{ date: fourDaysAhead, classes: ['bg-danger', 'text-warning'] } | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.