Skip to content

Commit

Permalink
fix: restore aot compatibility with angular 4
Browse files Browse the repository at this point in the history
Fixes #397
  • Loading branch information
mattlewis92 authored Nov 22, 2017
1 parent b649f6c commit f5e500a
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 108 deletions.
2 changes: 1 addition & 1 deletion karma.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default config => {
test: /\.(ts|js)($|\?)/i
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)esm5/,
/angular(\\|\/)core(\\|\/)@angular/,
__dirname + '/src'
)
]
Expand Down
125 changes: 54 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,16 @@
},
"homepage": "https://github.com/mattlewis92/angular-calendar#readme",
"devDependencies": {
"@angular/animations": "^5.0.2",
"@angular/cdk": "^5.0.0-rc0",
"@angular/common": "^5.0.2",
"@angular/compiler": "^5.0.2",
"@angular/compiler-cli": "^5.0.2",
"@angular/core": "^5.0.2",
"@angular/forms": "^5.0.2",
"@angular/language-service": "^5.0.2",
"@angular/platform-browser": "^5.0.2",
"@angular/platform-browser-dynamic": "^5.0.2",
"@angular/router": "^5.0.2",
"@angular/animations": "^4.4.4",
"@angular/common": "^4.4.4",
"@angular/compiler": "^4.4.4",
"@angular/compiler-cli": "^4.4.4",
"@angular/core": "^4.4.4",
"@angular/forms": "^4.4.4",
"@angular/language-service": "^4.4.4",
"@angular/platform-browser": "^4.4.4",
"@angular/platform-browser-dynamic": "^4.4.4",
"@angular/router": "^4.4.4",
"@commitlint/cli": "^5.0.1",
"@commitlint/config-angular": "^4.3.0",
"@commitlint/prompt": "^5.0.1",
Expand All @@ -93,7 +92,7 @@
"bootstrap": "4.0.0-beta",
"chai": "^4.1.2",
"codecov": "^3.0.0",
"codelyzer": "^4.0.1",
"codelyzer": "^3.2.2",
"commitizen": "^2.8.1",
"concurrently": "^3.1.0",
"copyfiles": "^1.2.0",
Expand Down Expand Up @@ -121,7 +120,7 @@
"lint-staged": "^5.0.0",
"mocha": "^4.0.1",
"moment": "^2.19.2",
"ngx-contextmenu": "^3.0.0",
"ngx-contextmenu": "^1.3.5",
"node-sass": "^4.7.1",
"offline-plugin": "^4.8.4",
"postcss-flexibility": "^2.0.0",
Expand All @@ -143,7 +142,7 @@
"tslint": "^5.7.0",
"tslint-config-mwl": "^0.2.1",
"tslint-loader": "^3.5.3",
"typescript": "~2.4.2",
"typescript": "^2.6.1",
"url-loader": "^0.6.2",
"web-animations-js": "^2.3.1",
"webpack": "^3.6.0",
Expand Down
28 changes: 20 additions & 8 deletions src/modules/common/calendar-angular-date-formatter.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,32 @@ export class CalendarAngularDateFormatter
* The month view header week day labels
*/
public monthViewColumnHeader({ date, locale }: DateFormatterParams): string {
return new DatePipe(locale).transform(date, 'EEEE', locale);
return ((new DatePipe(locale) as any) as any).transform(
date,
'EEEE',
locale
);
}

/**
* The month view cell day number
*/
public monthViewDayNumber({ date, locale }: DateFormatterParams): string {
return new DatePipe(locale).transform(date, 'd', locale);
return (new DatePipe(locale) as any).transform(date, 'd', locale);
}

/**
* The month view title
*/
public monthViewTitle({ date, locale }: DateFormatterParams): string {
return new DatePipe(locale).transform(date, 'MMMM y', locale);
return (new DatePipe(locale) as any).transform(date, 'MMMM y', locale);
}

/**
* The week view header week day labels
*/
public weekViewColumnHeader({ date, locale }: DateFormatterParams): string {
return new DatePipe(locale).transform(date, 'EEEE', locale);
return (new DatePipe(locale) as any).transform(date, 'EEEE', locale);
}

/**
Expand All @@ -47,14 +51,18 @@ export class CalendarAngularDateFormatter
date,
locale
}: DateFormatterParams): string {
return new DatePipe(locale).transform(date, 'MMM d', locale);
return (new DatePipe(locale) as any).transform(date, 'MMM d', locale);
}

/**
* The week view title
*/
public weekViewTitle({ date, locale }: DateFormatterParams): string {
const year: string = new DatePipe(locale).transform(date, 'y', locale);
const year: string = (new DatePipe(locale) as any).transform(
date,
'y',
locale
);
const weekNumber: number = getISOWeek(date);
return `Week ${weekNumber} of ${year}`;
}
Expand All @@ -64,13 +72,17 @@ export class CalendarAngularDateFormatter
*/
public dayViewHour({ date, locale }: DateFormatterParams): string {
const format = +VERSION.major === 4 ? 'j' : 'h a';
return new DatePipe(locale).transform(date, format, locale);
return (new DatePipe(locale) as any).transform(date, format, locale);
}

/**
* The day view title
*/
public dayViewTitle({ date, locale }: DateFormatterParams): string {
return new DatePipe(locale).transform(date, 'EEEE, MMMM d, y', locale);
return (new DatePipe(locale) as any).transform(
date,
'EEEE, MMMM d, y',
locale
);
}
}
Loading

0 comments on commit f5e500a

Please sign in to comment.