Skip to content

Commit 7cb7125

Browse files
authored
Merge branch 'master' into nrobakova/fix-issue-7258
2 parents db4a5c5 + a446bf8 commit 7cb7125

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

projects/igniteui-angular/src/lib/date-range-picker/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,15 @@ With projected inputs:
108108
### Inputs
109109
| Name | Type | Description |
110110
|:-----------------|:-------------------|:------------|
111-
| mode | InteractionMode | Sets whether `IgxDateRangePickerComponent` is in dialog or dropdown mode. Default is `dialog` |
112-
| monthsViewNumber | number | Sets the number displayed month views. Default is `2`. |
111+
| doneButtonText | string | Changes the default text of the `done` button. It will show up only in `dialog` mode. Default value is `Done`. |
112+
| formatter | function => string | Applies a custom formatter function on the selected or passed date. |
113113
| hideOutsideDays | boolean | Sets whether dates that are not part of the current month will be displayed. Default value is `false`. |
114-
| weekStart | number | Sets the start day of the week. Can be assigned to a numeric value or to `WEEKDAYS` enum value. |
115114
| locale | string | Gets the `locale` of the calendar. Default value is `"en"`. |
116-
| formatter | function => string | Applies a custom formatter function on the selected or passed date. |
117-
| doneButtonText | string | Changes the default text of the `done` button. It will show up only in `dialog` mode. Default value is `Done`. |
118115
| overlaySettings | OverlaySettings | Changes the default overlay settings used by the `IgxDateRangePickerComponent`. |
116+
| mode | InteractionMode | Sets whether `IgxDateRangePickerComponent` is in dialog or dropdown mode. Default is `dialog` |
117+
| monthsViewNumber | number | Sets the number displayed month views. Default is `2`. |
118+
| placeholder | string | Sets the `placeholder` for single-input `IgxDateRangePickerComponent`. |
119+
| weekStart | number | Sets the start day of the week. Can be assigned to a numeric value or to `WEEKDAYS` enum value. |
119120

120121
### Outputs
121122
| Name | Type | Description |

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ describe('IgxDateRangePicker', () => {
262262
});
263263

264264
describe('Properties & events tests', () => {
265+
it('should show date picker with placeholder', () => {
266+
fixture.detectChanges();
267+
expect(singleInputElement.nativeElement.placeholder).toEqual('MM/dd/yyyy - MM/dd/yyyy');
268+
269+
const placeholder = 'Some placeholder';
270+
fixture.componentInstance.dateRange.placeholder = placeholder;
271+
fixture.detectChanges();
272+
expect(singleInputElement.nativeElement.placeholder).toEqual(placeholder);
273+
});
265274
it('should close the calendar with the "Done" button', fakeAsync(() => {
266275
fixture.componentInstance.mode = InteractionMode.Dialog;
267276
fixture.detectChanges();
@@ -809,4 +818,7 @@ export class DateRangeDefaultCustomLabelComponent extends DateRangeTestComponent
809818
</igx-date-range-picker>
810819
`
811820
})
812-
export class DateRangeDefaultComponent extends DateRangeTestComponent { }
821+
export class DateRangeDefaultComponent extends DateRangeTestComponent {
822+
@ViewChild(IgxDateRangePickerComponent)
823+
public dateRange: IgxDateRangePickerComponent;
824+
}

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ export class IgxDateRangePickerComponent extends DisplayDensityBase
270270
@Input()
271271
public disabled: boolean;
272272

273+
/**
274+
* Sets the `placeholder` for single-input `IgxDateRangePickerComponent`.
275+
* @example
276+
* ```html
277+
* <igx-date-range-picker [placeholder]="'Choose your dates'"></igx-date-range-picker>
278+
* ```
279+
*/
280+
@Input()
281+
public placeholder = '';
282+
273283
/**
274284
* Emitted when a range is selected.
275285
*
@@ -369,6 +379,9 @@ export class IgxDateRangePickerComponent extends DisplayDensityBase
369379
return this.formatter(this.value);
370380
}
371381
if (!this.hasProjectedInputs) {
382+
if (this.placeholder !== '') {
383+
return this.placeholder;
384+
}
372385
// TODO: use displayFormat - see how shortDate, longDate can be defined
373386
return this.inputFormat
374387
? `${this.inputFormat} - ${this.inputFormat}`

0 commit comments

Comments
 (0)