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

Commit

Permalink
Fixed calendar weekdays not being static (#41)
Browse files Browse the repository at this point in the history
* Fixed calendar weekdays not being static.

* Moved logic to lower component and ensured 0 is returned if starting day is undefined.
  • Loading branch information
Blackbaud-TrevorBurch authored May 3, 2019
1 parent c496662 commit 4d6f8c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/app/public/modules/datepicker/datepicker-calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ export class SkyDatepickerCalendarComponent {
@Input()
public maxDate: Date;

/** starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) */
@Input()
public startingDay: number;

/** currently selected date */
@Input()
public selectedDate: Date;

/** starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) */
@Input()
public set startingDay(start: number) {
this._startingDay = start;
}

public get startingDay() {
return this._startingDay || 0;
}

@Output()
public selectedDateChange: EventEmitter<Date> = new EventEmitter<Date>(undefined);

Expand All @@ -51,6 +57,8 @@ export class SkyDatepickerCalendarComponent {

private formatter = new SkyDateFormatter();

private _startingDay: number;

public constructor(config: SkyDatepickerConfigService) {
this.config = config;
this.configureOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DatepickerCalendarTestComponent {

public selectedDate: any;

public startingDay: number = 0;
public startingDay: number;

@ViewChild(SkyDatepickerCalendarComponent)
public datepicker: SkyDatepickerCalendarComponent;
Expand Down

0 comments on commit 4d6f8c6

Please sign in to comment.