Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Fix datepicker startingday #1732

Merged
merged 31 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3f4222e
Resolving Card action bar still visable after hiding with *ngIf #1421
blackbaud-conorwright Mar 7, 2018
a450054
Addressed PR style comments
blackbaud-conorwright Mar 8, 2018
4b809aa
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 9, 2018
d55f351
Merge branch 'master' into master
Blackbaud-SteveBrush Mar 9, 2018
833bcc7
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 12, 2018
b553659
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 15, 2018
ab82ba3
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 19, 2018
db21c76
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 27, 2018
a282a86
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Mar 30, 2018
d210c2b
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 10, 2018
35e789d
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 17, 2018
636c5dd
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Apr 23, 2018
bdc97a6
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 1, 2018
6104aaf
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 2, 2018
37f50ec
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 8, 2018
76279cd
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 14, 2018
2324e90
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 16, 2018
d48b8f2
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 23, 2018
b2e318a
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 25, 2018
8d52945
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright May 25, 2018
194e01f
Merge remote-tracking branch 'upstream/master'
blackbaud-conorwright Jun 6, 2018
e741dcf
surfaced startingDay property on datepicker
blackbaud-conorwright Jun 11, 2018
7289a84
Merge branch 'master' into fix-datepicker-startingday
Blackbaud-SteveBrush Jun 11, 2018
ed6d731
Merge remote-tracking branch 'upstream/master' into fix-datepicker-st…
blackbaud-conorwright Jun 13, 2018
f8a7fc7
move startday to input to keep options on same elem
blackbaud-conorwright Jun 13, 2018
67ad279
fixed tslint issue
blackbaud-conorwright Jun 15, 2018
569c2ae
Merge branch 'master' into fix-datepicker-startingday
Blackbaud-SteveBrush Jun 18, 2018
1d51d90
switched to getters and setters for datepicker props
blackbaud-conorwright Jun 18, 2018
5716888
Merge branch 'fix-datepicker-startingday' of github.com:blackbaud/sky…
blackbaud-conorwright Jun 18, 2018
5b3e147
switched min and max back to using set func
blackbaud-conorwright Jun 18, 2018
b2abc1c
added default starting day to datepicker
blackbaud-conorwright Jun 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/modules/datepicker/datepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export class SkyDatepickerInputDirective implements
@Input()
public maxDate: Date;

@Input()
public startingDay: number = 0;

private dateFormatter = new SkyDateFormatter();

private modelValue: Date;
Expand Down Expand Up @@ -118,6 +121,11 @@ export class SkyDatepickerInputDirective implements
this._validatorChange();
this.skyDatepickerInput.setMaxDate(this.maxDate);
}

if (changes['startingDay']) {
this._validatorChange();
this.skyDatepickerInput.startingDay = this.startingDay;
}
}

@HostListener('change', ['$event'])
Expand Down
3 changes: 2 additions & 1 deletion src/modules/datepicker/datepicker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
(selectedDateChange)="dateSelected($event)"
(calendarModeChange)="onCalendarModeChange()"
[maxDate]="maxDate"
[minDate]="minDate">
[minDate]="minDate"
[startingDay]="startingDay">
</sky-datepicker-calendar>
</sky-dropdown-menu>
</sky-dropdown>
Expand Down
16 changes: 16 additions & 0 deletions src/modules/datepicker/datepicker.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,22 @@ describe('datepicker', () => {

expect(dateButtonEl).toHaveCssClass('sky-btn-disabled');
}));

it('should pass starting day to calendar', fakeAsync(() => {
component.selectedDate = new Date('5/21/2017');
component.startingDay = 5;
fixture.detectChanges();
tick();
fixture.detectChanges();

openDatepicker(fixture.nativeElement, fixture);
tick();

let firstDayCol = fixture.nativeElement
.querySelectorAll('.sky-datepicker-center.sky-datepicker-weekdays').item(0) as HTMLElement;

expect(firstDayCol.textContent).toContain('Fr');
}));
});
});

Expand Down
8 changes: 8 additions & 0 deletions src/modules/datepicker/datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ export class SkyDatepickerComponent {

public dropdownController = new Subject<SkyDropdownMessage>();
public dateChanged: EventEmitter<Date> = new EventEmitter<Date>();
private _startingDay: number = 0;
public maxDate: Date;
public minDate: Date;

public get startingDay(): number {
return this._startingDay;
}
public set startingDay(value: number) {
this._startingDay = value;
}

public dateSelected(newDate: Date) {
this.dateChanged.emit(newDate);
this.dropdownController.next({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<div>
<sky-datepicker #picker>
<sky-datepicker
#picker>
<input
name="myDate"
[(ngModel)]="selectedDate"
[skyDatepickerInput]="picker"
[minDate]="minDate"
[maxDate]="maxDate"
[startingDay]="startingDay"
[dateFormat]="format"
[skyDatepickerNoValidate]="noValidate"
#date="ngModel" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export class DatepickerTestComponent {

public format: string = 'MM/DD/YYYY';
public noValidate: boolean = false;
public startingDay = 0;
}