diff --git a/libs/components/datetime/src/lib/modules/date-pipe/date.pipe.spec.ts b/libs/components/datetime/src/lib/modules/date-pipe/date.pipe.spec.ts index 7ae57a0e6b..960c90f839 100644 --- a/libs/components/datetime/src/lib/modules/date-pipe/date.pipe.spec.ts +++ b/libs/components/datetime/src/lib/modules/date-pipe/date.pipe.spec.ts @@ -44,8 +44,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -62,8 +62,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -74,8 +74,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -85,8 +85,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -96,8 +96,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '3/3/2020, 12:00 AM', - '3/3/2020 12:00 AM', // IE 11 + '3/3/20, 12:00 AM', + '3/3/20 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -107,8 +107,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -143,13 +143,13 @@ describe('Date pipe', () => { expect(expectedValues).toContain(value); }); - it('should default to mediumDate format', () => { + it('should default to short format', () => { fixture.componentInstance.format = undefined; fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -158,10 +158,10 @@ describe('Date pipe', () => { fixture.componentInstance.locale = 'fr-CA'; fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces locale-specific time format const expectedValues = [ - '2000-01-01 00 h 00', - '2000-01-01, 00 h 00', // Chrome 88 - '2000-01-01 00:00', // IE 11 + '1/1/00, 12:00 h', + '1/1/00 12:00 h', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -171,8 +171,8 @@ describe('Date pipe', () => { let value = fixture.nativeElement.textContent.trim(); let expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); @@ -183,10 +183,10 @@ describe('Date pipe', () => { fixture.detectChanges(); value = fixture.nativeElement.textContent.trim(); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces locale-specific time format expectedValues = [ - '2000-01-01 00 h 00', - '2000-01-01, 00 h 00', // Chrome 88 - '2000-01-01 00:00', // IE 11 + '1/1/00, 12:00 h', + '1/1/00 12:00 h', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -196,8 +196,8 @@ describe('Date pipe', () => { const date = new Date(2000, 0, 1); const pipe = new SkyDatePipe(); const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; const value = pipe.transform(date, 'short'); @@ -211,8 +211,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/11/2017', - '1/12/2017', // Firefox + '1/11/17', + '1/12/17', // Firefox ]; expect(expectedValues).toContain(value); }); @@ -223,8 +223,8 @@ describe('Date pipe', () => { fixture.detectChanges(); const value = fixture.nativeElement.textContent.trim(); const expectedValues = [ - '1/20/2017', - '1/21/2017', // Firefox + '1/20/17', + '1/21/17', // Firefox ]; expect(expectedValues).toContain(value); }); @@ -245,10 +245,10 @@ describe('Date pipe', () => { fixture.detectChanges(); const date = new Date(2000, 0, 1); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces locale-specific time format const expectedValues = [ - '2000-01-01 00 h 00', - '2000-01-01, 00 h 00', // Chrome 88 - '2000-01-01 00:00', // IE 11 + '1/1/00, 12:00 h', + '1/1/00 12:00 h', // IE 11 ]; const result = fixture.componentInstance.getDatePipeResult( diff --git a/libs/components/datetime/src/lib/modules/date-pipe/date.service.spec.ts b/libs/components/datetime/src/lib/modules/date-pipe/date.service.spec.ts index 0d43cfcf3f..bf13747eaf 100644 --- a/libs/components/datetime/src/lib/modules/date-pipe/date.service.spec.ts +++ b/libs/components/datetime/src/lib/modules/date-pipe/date.service.spec.ts @@ -41,9 +41,10 @@ describe('Date service', () => { it('should format a date object', () => { const value = service.format(new Date(2000, 0, 1)); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -56,45 +57,50 @@ describe('Date service', () => { it('should format a timestamp', () => { const value = service.format(new Date(2000, 0, 1, 0).getTime()); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); it('should format an ISO date string', () => { const value = service.format(new Date(2000, 0, 1, 0).toISOString()); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); it('should format an incomplete ISO date string without time', () => { const value = service.format('2000-01-01'); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); it('should format an incomplete ISO date string without time zone', () => { const value = service.format('2020-03-03T00:00:00'); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '3/3/2020, 12:00 AM', - '3/3/2020 12:00 AM', // IE 11 + '3/3/20, 12:00 AM', + '3/3/20 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); it('should format a date string', () => { const value = service.format('2000/1/1'); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -119,16 +125,16 @@ describe('Date service', () => { /* spell-checker:disable */ const formats = new Map([ - ['short', 'yMdjm'], - ['medium', 'yMMMdjms'], + ['short', 'M/d/yy, h:mm a'], + ['medium', 'MMM d, y, h:mm:ss a'], ['long', 'MMMM d, y, h:mm:ss a Z'], ['full', 'EEEE, MMMM d, y, h:mm:ss a z'], - ['shortDate', 'yMd'], - ['mediumDate', 'yMMMd'], - ['longDate', 'yMMMMd'], - ['fullDate', 'yMMMMEEEEd'], - ['shortTime', 'jm'], - ['mediumTime', 'jms'], + ['shortDate', 'M/d/yy'], + ['mediumDate', 'MMM d, y'], + ['longDate', 'MMMM d, y'], + ['fullDate', 'EEEE, MMMM d, y'], + ['shortTime', 'h:mm a'], + ['mediumTime', 'h:mm:ss a'], ['longTime', 'h:mm:ss a Z'], ['fullTime', 'h:mm:ss a z'], ]); @@ -142,28 +148,30 @@ describe('Date service', () => { it('should default to mediumDate format', () => { const value = service.format(new Date(2000, 0, 1)); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); it('should support changing locale inline', () => { const value = service.format(new Date(2000, 0, 1), 'fr-CA'); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces locale-specific time format const expectedValues = [ - '2000-01-01 00 h 00', - '2000-01-01, 00 h 00', // Chrome 88 - '2000-01-01 00:00', // IE 11 + '1/1/00, 12:00 h', + '1/1/00 12:00 h', // IE 11 ]; expect(expectedValues).toContain(value); }); it('should respect locale set by SkyAppLocaleProvider', () => { let value = service.format(new Date(2000, 0, 1)); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years let expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); @@ -172,10 +180,10 @@ describe('Date service', () => { }); value = service.format(new Date(2000, 0, 1)); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces locale-specific time format expectedValues = [ - '2000-01-01 00 h 00', - '2000-01-01, 00 h 00', // Chrome 88 - '2000-01-01 00:00', // IE 11 + '1/1/00, 12:00 h', + '1/1/00 12:00 h', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -183,9 +191,10 @@ describe('Date service', () => { it('should default to en-US locale', () => { const date = new Date(2000, 0, 1); const value = service.format(date, 'short'); + // After breaking change: format is now 'M/d/yy, h:mm a' which produces 2-digit years const expectedValues = [ - '1/1/2000, 12:00 AM', - '1/1/2000 12:00 AM', // IE 11 + '1/1/00, 12:00 AM', + '1/1/00 12:00 AM', // IE 11 ]; expect(expectedValues).toContain(value); }); @@ -196,9 +205,10 @@ describe('Date service', () => { undefined, 'shortDate', ); + // After breaking change: format is now 'M/d/yy' which produces 2-digit years const expectedValues = [ - '1/11/2017', - '1/12/2017', // Firefox + '1/11/17', + '1/12/17', // Firefox ]; expect(expectedValues).toContain(value); }); @@ -209,9 +219,10 @@ describe('Date service', () => { undefined, 'shortDate', ); + // After breaking change: format is now 'M/d/yy' which produces 2-digit years const expectedValues = [ - '1/20/2017', - '1/21/2017', // Firefox + '1/20/17', + '1/21/17', // Firefox ]; expect(expectedValues).toContain(value); }); diff --git a/libs/components/datetime/src/lib/modules/date-pipe/date.service.ts b/libs/components/datetime/src/lib/modules/date-pipe/date.service.ts index 1f8fc913b6..337b0c4375 100644 --- a/libs/components/datetime/src/lib/modules/date-pipe/date.service.ts +++ b/libs/components/datetime/src/lib/modules/date-pipe/date.service.ts @@ -24,29 +24,21 @@ export class SkyDateService implements OnDestroy { // See: https://github.com/angular/angular/blob/17.3.x/packages/common/src/pipes/date_pipe.ts // See: https://www.ibm.com/docs/en/app-connect/11.0.0?topic=function-formatting-parsing-datetimes-as-strings #ALIASES: Record = { - // TODO: replace with 'M/d/yy, h:mm a' in a breaking change. - short: 'yMdjm', - // TODO: replace with 'MMM d, y, h:mm:ss a' in a breaking change. - medium: 'yMMMdjms', - // TODO: This format was modified from 'MMMM d, y, h:mm:ss a z' due to the limitations of the Intl API. + short: 'M/d/yy, h:mm a', + medium: 'MMM d, y, h:mm:ss a', + // This format was modified from 'MMMM d, y, h:mm:ss a z' due to the limitations of the Intl API. long: 'MMMM d, y, h:mm:ss a Z', - // TODO: This format was modified from 'EEEE, MMMM d, y, h:mm:ss a zzzz' due to the limitations of the Intl API. + // This format was modified from 'EEEE, MMMM d, y, h:mm:ss a zzzz' due to the limitations of the Intl API. full: 'EEEE, MMMM d, y, h:mm:ss a z', - // TODO: Replace with 'M/d/yy' in a breaking change. - shortDate: 'yMd', - // TODO: Replace with 'MMM d, y' in a breaking change. - mediumDate: 'yMMMd', - // TODO: Replace with 'MMMM d, y' in a breaking change. - longDate: 'yMMMMd', - // TODO: Replace with 'EEEE, MMMM d, y' in a breaking change. - fullDate: 'yMMMMEEEEd', - // TODO: Replace with 'h:mm a' in a breaking change. - shortTime: 'jm', - // TODO: Replace with 'h:mm:ss a' in a breaking change. - mediumTime: 'jms', - // TODO: This format was modified from 'h:mm:ss a z' due to the limitations of the Intl API. + shortDate: 'M/d/yy', + mediumDate: 'MMM d, y', + longDate: 'MMMM d, y', + fullDate: 'EEEE, MMMM d, y', + shortTime: 'h:mm a', + mediumTime: 'h:mm:ss a', + // This format was modified from 'h:mm:ss a z' due to the limitations of the Intl API. longTime: 'h:mm:ss a Z', - // TODO: This format was modified from 'h:mm:ss a zzzz' due to the limitations of the Intl API. + // This format was modified from 'h:mm:ss a zzzz' due to the limitations of the Intl API. fullTime: 'h:mm:ss a z', }; /* spell-checker:enable */ diff --git a/libs/components/flyout/src/lib/modules/flyout/flyout-instance.ts b/libs/components/flyout/src/lib/modules/flyout/flyout-instance.ts index 1c5068e26b..44aeb6432b 100644 --- a/libs/components/flyout/src/lib/modules/flyout/flyout-instance.ts +++ b/libs/components/flyout/src/lib/modules/flyout/flyout-instance.ts @@ -112,17 +112,8 @@ export class SkyFlyoutInstance { #_hostController = new Subject(); - // TODO: Remove this being optional in a future breaking change. - constructor(componentInstance?: T) { - if (!componentInstance) { - console.warn( - `The SkyFlyoutInstance was created without a reference to the flyout's child component instance. - The instance will not have a reference to this child component. - Support for creating an instance without this reference will be removed in a future breaking change.`, - ); - } - - this.componentInstance = componentInstance!; + constructor(componentInstance: T) { + this.componentInstance = componentInstance; this.closed.subscribe(() => { this.isOpen = false; }); diff --git a/libs/components/lists/src/lib/modules/repeater/repeater.service.ts b/libs/components/lists/src/lib/modules/repeater/repeater.service.ts index 9f6680f3f1..95441cfbc6 100644 --- a/libs/components/lists/src/lib/modules/repeater/repeater.service.ts +++ b/libs/components/lists/src/lib/modules/repeater/repeater.service.ts @@ -24,7 +24,6 @@ export class SkyRepeaterService implements OnDestroy { public enableActiveState = false; - // TODO: Remove 'string' as a valid type in a breaking change. public get expandMode(): SkyRepeaterExpandModeType { return this.#_expandMode; } diff --git a/libs/components/lists/src/lib/modules/sort/sort-item.component.ts b/libs/components/lists/src/lib/modules/sort/sort-item.component.ts index bd8c2b55fc..328ca87727 100644 --- a/libs/components/lists/src/lib/modules/sort/sort-item.component.ts +++ b/libs/components/lists/src/lib/modules/sort/sort-item.component.ts @@ -41,7 +41,7 @@ export class SkySortItemComponent implements OnInit, OnChanges, OnDestroy { * Fires when a sort item is selected. */ @Output() - public itemSelect = new EventEmitter(); // TODO: Change to `EventEmitter` in a breaking change. + public itemSelect = new EventEmitter(); public isSelected: BehaviorSubject = new BehaviorSubject( false,