diff --git a/src/lib/core/datetime/simple-date.ts b/src/lib/core/datetime/simple-date.ts index 29e19338162d..75a498425d57 100644 --- a/src/lib/core/datetime/simple-date.ts +++ b/src/lib/core/datetime/simple-date.ts @@ -7,12 +7,12 @@ export class SimpleDate { * Create a SimpleDate from a native JS Date object. * @param nativeDate The native JS Date object to convert. */ - static fromNativeDate(nativeDate: Date) { + static fromNativeDate(nativeDate: Date): SimpleDate { return new SimpleDate(nativeDate.getFullYear(), nativeDate.getMonth(), nativeDate.getDate()); } /** Creates a SimpleDate object representing today. */ - static today() { + static today(): SimpleDate { return SimpleDate.fromNativeDate(new Date()); } @@ -29,22 +29,22 @@ export class SimpleDate { } /** The year component of this date. */ - get year() { + get year(): number { return this._date.getFullYear(); } /** The month component of this date. (0-indexed, 0 = January). */ - get month() { + get month(): number { return this._date.getMonth(); } /** The date component of this date. (1-indexed, 1 = 1st of month). */ - get date() { + get date(): number { return this._date.getDate(); } /** The day component of this date. (0-indexed, 0 = Sunday) */ - get day() { + get day(): number { return this._date.getDay(); } @@ -52,7 +52,7 @@ export class SimpleDate { * Adds an amount of time (in days, months, and years) to the date. * @param amount The amount of time to add. */ - add(amount: {days: number, months: number, years: number}) { + add(amount: {days: number, months: number, years: number}): SimpleDate { return new SimpleDate( this.year + amount.years || 0, this.month + amount.months || 0, @@ -60,7 +60,7 @@ export class SimpleDate { } /** Converts the SimpleDate to a native JS Date object. */ - toNativeDate() { + toNativeDate(): Date { return new Date(this.year, this.month, this.date); } } diff --git a/src/lib/datepicker/calendar-table.scss b/src/lib/datepicker/calendar-table.scss index f6c99a7df15e..2b3503ef0227 100644 --- a/src/lib/datepicker/calendar-table.scss +++ b/src/lib/datepicker/calendar-table.scss @@ -2,6 +2,7 @@ $mat-calendar-table-font-size: 12px !default; $mat-calendar-table-cell-padding: 1px !default; $mat-calendar-table-cell-content-size: 32px !default; $mat-calendar-table-cell-content-border-width: 1px !default; +$mat-calendar-table-label-padding-start: 10px !default; .mat-calendar-table-table { @@ -11,7 +12,7 @@ $mat-calendar-table-cell-content-border-width: 1px !default; .mat-calendar-table-label { height: $mat-calendar-table-cell-content-size; - padding: 0 0 0 10px; + padding: 0 0 0 $mat-calendar-table-label-padding-start; text-align: left; font-weight: normal; } @@ -33,7 +34,7 @@ $mat-calendar-table-cell-content-border-width: 1px !default; [dir='rtl'] { .mat-calendar-table-label { - padding: 0 10px 0 0; + padding: 0 $mat-calendar-table-label-padding-start 0 0; text-align: right; } } diff --git a/src/lib/datepicker/calendar-table.spec.ts b/src/lib/datepicker/calendar-table.spec.ts index a7f12e786d3f..fb9869bda99a 100644 --- a/src/lib/datepicker/calendar-table.spec.ts +++ b/src/lib/datepicker/calendar-table.spec.ts @@ -69,8 +69,8 @@ describe('MdCalendarTable', () => { expect(rowEls.length).toBe(2); expect(labelEls.length).toBe(1); expect(cellEls.length).toBe(11); - expect(rowEls[0].firstElementChild.classList.contains('mat-calendar-table-label')).toBe( - true, 'first cell should be the label'); + expect(rowEls[0].firstElementChild.classList) + .toContain('mat-calendar-table-label', 'first cell should be the label'); expect(labelEls[0].getAttribute('colspan')).toBe('3'); }); @@ -80,8 +80,8 @@ describe('MdCalendarTable', () => { todayElement.click(); fixture.detectChanges(); - expect(todayElement.classList.contains('mat-calendar-table-selected')).toBe( - true, 'today should be selected'); + expect(todayElement.classList) + .toContain('mat-calendar-table-selected', 'today should be selected'); }); }); });