Skip to content

Commit 9a79f5f

Browse files
committed
chore(*): Update tests and API use for latest version.
1 parent a9ee6c2 commit 9a79f5f

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

projects/igniteui-angular/src/lib/core/i18n/resources.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
import { getCurrentResourceStrings, getI18nManager, registerI18n, setCurrentI18n } from 'igniteui-i18n-core';
1+
import { getCurrentResourceStrings, getI18nManager, IResourceStrings, registerI18n, setCurrentI18n } from 'igniteui-i18n-core';
22
import { ActionStripResourceStringsEN } from './action-strip-resources';
33
import { BannerResourceStringsEN } from './banner-resources';
44
import { changei18n, getCurrentResourceStrings as igxGetCurrentResourceStrings } from './resources';
55
import { ActionStripResourceStringsBG } from 'projects/igniteui-angular-i18n/src/i18n/BG/action-strip-resources';
66
import { BannerResourceStringsBG, ResourceStringsBG } from 'igniteui-i18n-resources';
7+
import { IResourceCategories } from 'node_modules/igniteui-i18n-core/i18n-manager.interfaces';
78

89
describe('i18n', () => {
910
beforeEach(() => {
1011
// Clear manager state between tests.
11-
getI18nManager()['_resourcesMap'] = new Map([[getI18nManager().currentLocale, {}]]);
12+
(getI18nManager() as any)._resourcesMap = new Map<string, IResourceCategories>([
13+
[
14+
'en',
15+
{
16+
default: 'US',
17+
scripts: new Map<string, IResourceStrings>(),
18+
regions: new Map<string, IResourceStrings>([['US', {}]]),
19+
},
20+
],
21+
]);
1222
});
1323

1424
describe('old public API', () => {

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ export function formatDate(value: Date | string | number | null | undefined, for
723723
} else if (format?.includes('Time')) {
724724
timeStyle = format.replace('Time', '');
725725
} else if (format) {
726-
return getDateFormatter().formatDateCustomFormat(value, locale, format, false, timezone);
726+
return getDateFormatter().formatDateCustomFormat(value, format, { locale, timezone });
727727
}
728728
const options: Intl.DateTimeFormatOptions = {
729729
dateStyle,

src/app/grid-localization/grid-localization.sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,6 @@ export class GridLocalizationSampleComponent implements OnInit {
141141

142142
public onButtonClick() {
143143
console.log("Old: " + formatDate(new Date("10/10/1993"), this.inputValue, this.locale));
144-
console.log("New: " + getDateFormatter().formatDateCustomFormat(new Date("10/10/1993"), this.locale, this.inputValue));
144+
console.log("New: " + getDateFormatter().formatDateCustomFormat(new Date("10/10/1993"), this.inputValue, { locale: this.locale }));
145145
}
146146
}

0 commit comments

Comments
 (0)