-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(datepicker): date parsing when using a custom date format (#3522)
- Loading branch information
1 parent
8fe43e2
commit 5c2aa9e
Showing
6 changed files
with
50 additions
and
4 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
19 changes: 19 additions & 0 deletions
19
demo/src/app/components/+datepicker/demos/custom-format/date-picker-custom-format.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,19 @@ | ||
<div class="row"> | ||
<div class="col-xs-12 col-12 col-md-4 form-group"> | ||
<form [formGroup]="myForm"> | ||
<input | ||
class="form-control" | ||
[minDate]="minDate" | ||
[maxDate]="maxDate" | ||
#dp="bsDatepicker" | ||
bsDatepicker | ||
formControlName="myDate" | ||
[bsConfig]="{ dateInputFormat: 'YYYY-MM-DD' }" | ||
> | ||
</form> | ||
</div> | ||
<div class="col-xs-12 col-12 col-md-3 form-group"> | ||
<button class="btn btn-success" (click)="dp.toggle()">Date Picker</button> | ||
</div> | ||
</div> | ||
<br> |
15 changes: 15 additions & 0 deletions
15
demo/src/app/components/+datepicker/demos/custom-format/date-picker-custom-format.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,15 @@ | ||
import { Component } from '@angular/core'; | ||
import { FormControl, FormGroup } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'demo-date-picker-custom-format', | ||
templateUrl: './date-picker-custom-format.html' | ||
}) | ||
export class DemoDatePickerCustomFormatComponent { | ||
minDate = new Date(2017, 5, 10); | ||
maxDate = new Date(2018, 9, 15); | ||
|
||
myForm = new FormGroup({ | ||
myDate: new FormControl(new Date()) | ||
}); | ||
} |
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