Skip to content

MatCalendarHeader at version8 periodButtonText doesn't display TH local format #17187

@Bhadhorn

Description

@Bhadhorn

Expected Behavior

get periodButtonText(): string {
if (this.calendar.currentView == 'month') {
return this._dateAdapter
.format(this.calendar.activeDate, this._dateFormats.display.monthYearLabel)
.toLocaleUpperCase();
}
if (this.calendar.currentView == 'year') {
return this._dateAdapter.getYearName(this.calendar.activeDate);
}
const activeYear = this._dateAdapter.getYear(this.calendar.activeDate);
const firstYearInView = this._dateAdapter.getYearName(
this._dateAdapter.createDate(activeYear - activeYear % 24, 0, 1));
const lastYearInView = this._dateAdapter.getYearName(
this._dateAdapter.createDate(activeYear + yearsPerPage - 1 - activeYear % 24, 0, 1));
return ${firstYearInView} \u2013 ${lastYearInView};
}

Actual Behavior

get periodButtonText(): string {
if (this.calendar.currentView == 'month') {
return this._dateAdapter
.format(this.calendar.activeDate, this._dateFormats.display.monthYearLabel)
.toLocaleUpperCase();
}
if (this.calendar.currentView == 'year') {
return this._dateAdapter.getYearName(this.calendar.activeDate);
}

const activeYear = this._dateAdapter.getYear(this.calendar.activeDate);
const minYearOfPage = activeYear - getActiveOffset(
  this._dateAdapter, this.calendar.activeDate, this.calendar.minDate, this.calendar.maxDate);
const maxYearOfPage = minYearOfPage + yearsPerPage - 1;
return `${minYearOfPage} \u2013 ${maxYearOfPage}`;

}

What behavior did you actually see?

  • Look at firstYearInView and lastYearInView on version 6 has getYearName() but version 8 doesn't
    that make some locale time display is unusual.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions