Skip to content

Commit f5e500a

Browse files
authored
fix: restore aot compatibility with angular 4
Fixes #397
1 parent b649f6c commit f5e500a

7 files changed

+97
-108
lines changed

karma.conf.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default config => {
8787
test: /\.(ts|js)($|\?)/i
8888
}),
8989
new webpack.ContextReplacementPlugin(
90-
/angular(\\|\/)core(\\|\/)esm5/,
90+
/angular(\\|\/)core(\\|\/)@angular/,
9191
__dirname + '/src'
9292
)
9393
]

package-lock.json

+54-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+13-14
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,16 @@
6262
},
6363
"homepage": "https://github.com/mattlewis92/angular-calendar#readme",
6464
"devDependencies": {
65-
"@angular/animations": "^5.0.2",
66-
"@angular/cdk": "^5.0.0-rc0",
67-
"@angular/common": "^5.0.2",
68-
"@angular/compiler": "^5.0.2",
69-
"@angular/compiler-cli": "^5.0.2",
70-
"@angular/core": "^5.0.2",
71-
"@angular/forms": "^5.0.2",
72-
"@angular/language-service": "^5.0.2",
73-
"@angular/platform-browser": "^5.0.2",
74-
"@angular/platform-browser-dynamic": "^5.0.2",
75-
"@angular/router": "^5.0.2",
65+
"@angular/animations": "^4.4.4",
66+
"@angular/common": "^4.4.4",
67+
"@angular/compiler": "^4.4.4",
68+
"@angular/compiler-cli": "^4.4.4",
69+
"@angular/core": "^4.4.4",
70+
"@angular/forms": "^4.4.4",
71+
"@angular/language-service": "^4.4.4",
72+
"@angular/platform-browser": "^4.4.4",
73+
"@angular/platform-browser-dynamic": "^4.4.4",
74+
"@angular/router": "^4.4.4",
7675
"@commitlint/cli": "^5.0.1",
7776
"@commitlint/config-angular": "^4.3.0",
7877
"@commitlint/prompt": "^5.0.1",
@@ -93,7 +92,7 @@
9392
"bootstrap": "4.0.0-beta",
9493
"chai": "^4.1.2",
9594
"codecov": "^3.0.0",
96-
"codelyzer": "^4.0.1",
95+
"codelyzer": "^3.2.2",
9796
"commitizen": "^2.8.1",
9897
"concurrently": "^3.1.0",
9998
"copyfiles": "^1.2.0",
@@ -121,7 +120,7 @@
121120
"lint-staged": "^5.0.0",
122121
"mocha": "^4.0.1",
123122
"moment": "^2.19.2",
124-
"ngx-contextmenu": "^3.0.0",
123+
"ngx-contextmenu": "^1.3.5",
125124
"node-sass": "^4.7.1",
126125
"offline-plugin": "^4.8.4",
127126
"postcss-flexibility": "^2.0.0",
@@ -143,7 +142,7 @@
143142
"tslint": "^5.7.0",
144143
"tslint-config-mwl": "^0.2.1",
145144
"tslint-loader": "^3.5.3",
146-
"typescript": "~2.4.2",
145+
"typescript": "^2.6.1",
147146
"url-loader": "^0.6.2",
148147
"web-animations-js": "^2.3.1",
149148
"webpack": "^3.6.0",

src/modules/common/calendar-angular-date-formatter.provider.ts

+20-8
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,32 @@ export class CalendarAngularDateFormatter
1616
* The month view header week day labels
1717
*/
1818
public monthViewColumnHeader({ date, locale }: DateFormatterParams): string {
19-
return new DatePipe(locale).transform(date, 'EEEE', locale);
19+
return ((new DatePipe(locale) as any) as any).transform(
20+
date,
21+
'EEEE',
22+
locale
23+
);
2024
}
2125

2226
/**
2327
* The month view cell day number
2428
*/
2529
public monthViewDayNumber({ date, locale }: DateFormatterParams): string {
26-
return new DatePipe(locale).transform(date, 'd', locale);
30+
return (new DatePipe(locale) as any).transform(date, 'd', locale);
2731
}
2832

2933
/**
3034
* The month view title
3135
*/
3236
public monthViewTitle({ date, locale }: DateFormatterParams): string {
33-
return new DatePipe(locale).transform(date, 'MMMM y', locale);
37+
return (new DatePipe(locale) as any).transform(date, 'MMMM y', locale);
3438
}
3539

3640
/**
3741
* The week view header week day labels
3842
*/
3943
public weekViewColumnHeader({ date, locale }: DateFormatterParams): string {
40-
return new DatePipe(locale).transform(date, 'EEEE', locale);
44+
return (new DatePipe(locale) as any).transform(date, 'EEEE', locale);
4145
}
4246

4347
/**
@@ -47,14 +51,18 @@ export class CalendarAngularDateFormatter
4751
date,
4852
locale
4953
}: DateFormatterParams): string {
50-
return new DatePipe(locale).transform(date, 'MMM d', locale);
54+
return (new DatePipe(locale) as any).transform(date, 'MMM d', locale);
5155
}
5256

5357
/**
5458
* The week view title
5559
*/
5660
public weekViewTitle({ date, locale }: DateFormatterParams): string {
57-
const year: string = new DatePipe(locale).transform(date, 'y', locale);
61+
const year: string = (new DatePipe(locale) as any).transform(
62+
date,
63+
'y',
64+
locale
65+
);
5866
const weekNumber: number = getISOWeek(date);
5967
return `Week ${weekNumber} of ${year}`;
6068
}
@@ -64,13 +72,17 @@ export class CalendarAngularDateFormatter
6472
*/
6573
public dayViewHour({ date, locale }: DateFormatterParams): string {
6674
const format = +VERSION.major === 4 ? 'j' : 'h a';
67-
return new DatePipe(locale).transform(date, format, locale);
75+
return (new DatePipe(locale) as any).transform(date, format, locale);
6876
}
6977

7078
/**
7179
* The day view title
7280
*/
7381
public dayViewTitle({ date, locale }: DateFormatterParams): string {
74-
return new DatePipe(locale).transform(date, 'EEEE, MMMM d, y', locale);
82+
return (new DatePipe(locale) as any).transform(
83+
date,
84+
'EEEE, MMMM d, y',
85+
locale
86+
);
7587
}
7688
}

0 commit comments

Comments
 (0)