Skip to content

Commit

Permalink
fix(module:date-picker): cell title should reflect nzFormat (#8744)
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVermeulen authored Dec 21, 2024
1 parent 0a73deb commit 1b7ab5a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/date-picker/date-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export type NzPlacement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
[extraFooter]="extraFooter"
[ranges]="nzRanges"
[dir]="dir"
[format]="nzFormat"
(resultOk)="onResultOk()"
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions components/date-picker/date-range-popup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import { getTimeConfig, isAllowedDate, PREFIX_CLASS } from './util';
[dateRender]="dateRender"
[selectedValue]="$any(datePickerService?.value)"
[hoverValue]="$any(hoverValue)"
[format]="format"
(cellHover)="onCellHover($event)"
(selectDate)="changeValueFromSelect($event, !showTime)"
(selectTime)="onSelectTime($event, partType)"
Expand Down Expand Up @@ -163,6 +164,7 @@ export class DateRangePopupComponent implements OnInit, OnChanges, OnDestroy {
@Input() panelMode!: NzDateMode | NzDateMode[];
@Input() defaultPickerValue!: CompatibleDate | undefined | null;
@Input() dir: Direction = 'ltr';
@Input() format?: string;

@Output() readonly panelModeChange = new EventEmitter<NzPanelChangeType>();
@Output() readonly calendarChange = new EventEmitter<CompatibleValue>();
Expand Down
2 changes: 2 additions & 0 deletions components/date-picker/inner-popup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ import { PREFIX_CLASS } from './util';
[selectedValue]="selectedValue"
[hoverValue]="hoverValue"
[canSelectWeek]="panelMode === 'week'"
[format]="format"
(valueChange)="onSelectDate($event)"
(cellHover)="cellHover.emit($event)"
/>
Expand Down Expand Up @@ -197,6 +198,7 @@ export class InnerPopupComponent implements OnChanges {
@Input() hoverValue!: CandyDate[]; // Range ONLY
@Input() value!: CandyDate;
@Input() partType!: RangePartType;
@Input() format?: string;

@Output() readonly panelChange = new EventEmitter<NzPanelChangeType>();
// TODO: name is not proper
Expand Down
3 changes: 2 additions & 1 deletion components/date-picker/lib/date-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { transCompatFormat } from './util';
})
export class DateTableComponent extends AbstractTable implements OnChanges, OnInit {
@Input() override locale!: NzCalendarI18nInterface;
@Input() format?: string;

constructor(private i18n: NzI18nService, private dateHelper: DateHelperService) {
super();
Expand Down Expand Up @@ -77,7 +78,7 @@ export class DateTableComponent extends AbstractTable implements OnChanges, OnIn

for (let day = 0; day < 7; day++) {
const date = weekStart.addDays(day);
const dateFormat = transCompatFormat(this.i18n.getLocaleData('DatePicker.lang.dateFormat', 'YYYY-MM-DD'));
const dateFormat = transCompatFormat(this.format ?? this.i18n.getLocaleData('DatePicker.lang.dateFormat', 'YYYY-MM-DD'));
const title = this.dateHelper.format(date.nativeDate, dateFormat);
const label = this.dateHelper.format(date.nativeDate, 'dd');
const cell: DateCell = {
Expand Down

0 comments on commit 1b7ab5a

Please sign in to comment.