Skip to content

Commit

Permalink
feat(material-luxon-adapter): update to luxon 3 (#25660)
Browse files Browse the repository at this point in the history
Updates the Luxon date adapter to Luxon 3 and fixes a compilation error.

BREAKING CHANGE:
The `MatLuxonDateModule` now requires at least version 3 of Luxon.

Fixes #25408.
  • Loading branch information
crisbeto authored Sep 19, 2022
1 parent 0a3a556 commit e1c0c55
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/jasmine": "^4.0.0",
"@types/luxon": "^1.27.0",
"@types/luxon": "^3.0.0",
"@types/marked": "^2.0.0",
"@types/node": "^16.10.9",
"@types/node-fetch": "^2.5.5",
Expand Down Expand Up @@ -190,7 +190,7 @@
"karma-requirejs": "^1.1.0",
"karma-sauce-launcher": "^4.3.6",
"karma-sourcemap-loader": "^0.3.8",
"luxon": "^2.3.0",
"luxon": "^3.0.0",
"madge": "^4.0.0",
"marked": "^2.0.0",
"minimatch": "^3.0.4",
Expand Down
7 changes: 3 additions & 4 deletions src/material-luxon-adapter/adapter/luxon-date-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@ import {
DateTimeOptions as LuxonDateTimeOptions,
} from 'luxon';

/** Configurable options for {@see LuxonDateAdapter}. */
/** Configurable options for the `LuxonDateAdapter`. */
export interface MatLuxonDateAdapterOptions {
/**
* Turns the use of utc dates on or off.
* Changing this will change how Angular Material components like DatePicker output dates.
* {@default false}
*/
useUtc: boolean;

/**
* Sets the first day of week.
* Changing this will change how Angular Material components like DatePicker shows start of week.
* {@default 0}
*/
firstDayOfWeek: number;
}
Expand Down Expand Up @@ -197,7 +195,8 @@ export class LuxonDateAdapter extends DateAdapter<LuxonDateTime> {
}
return date
.setLocale(this.locale)
.toFormat(displayFormat, {timeZone: this._useUTC ? 'utc' : undefined});
.setZone(this._useUTC ? 'utc' : undefined)
.toFormat(displayFormat);
}

addCalendarYears(date: LuxonDateTime, years: number): LuxonDateTime {
Expand Down
2 changes: 1 addition & 1 deletion src/material-luxon-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"peerDependencies": {
"@angular/material": "0.0.0-PLACEHOLDER",
"@angular/core": "0.0.0-NG",
"luxon": "^2.0.0"
"luxon": "^3.0.0"
},
"dependencies": {
"tslib": "0.0.0-TSLIB"
Expand Down
18 changes: 8 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@

"@angular/build-tooling@https://github.com/angular/dev-infra-private-build-tooling-builds.git#6f2cb5cf1860e75368528cf2216798db6f94d937":
version "0.0.0-bf4bb09bb2d32015f71943371c7484cb845f8c33"
uid "6f2cb5cf1860e75368528cf2216798db6f94d937"
resolved "https://github.com/angular/dev-infra-private-build-tooling-builds.git#6f2cb5cf1860e75368528cf2216798db6f94d937"
dependencies:
"@angular-devkit/build-angular" "14.2.0-rc.0"
Expand Down Expand Up @@ -388,7 +387,6 @@

"@angular/ng-dev@https://github.com/angular/dev-infra-private-ng-dev-builds.git#170605f156be18f179ad0024d386d4a7c05efa9a":
version "0.0.0-bf4bb09bb2d32015f71943371c7484cb845f8c33"
uid "170605f156be18f179ad0024d386d4a7c05efa9a"
resolved "https://github.com/angular/dev-infra-private-ng-dev-builds.git#170605f156be18f179ad0024d386d4a7c05efa9a"
dependencies:
"@yarnpkg/lockfile" "^1.1.0"
Expand Down Expand Up @@ -3754,10 +3752,10 @@
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9"
integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==

"@types/luxon@^1.27.0":
version "1.27.1"
resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-1.27.1.tgz#aceeb2d5be8fccf541237e184e37ecff5faa9096"
integrity sha512-cPiXpOvPFDr2edMnOXlz3UBDApwUfR+cpizvxCy0n3vp9bz/qe8BWzHPIEFcy+ogUOyjKuCISgyq77ELZPmkkg==
"@types/luxon@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.0.1.tgz#2b1657096473e24b049bdedf3710f99645f3a17f"
integrity sha512-/LAvk1cMOJt0ghzMFrZEvByUhsiEfeeT2IF53Le+Ki3A538yEL9pRZ7a6MuCxdrYK+YNqNIDmrKU/r2nnw04zQ==

"@types/marked@^2.0.0":
version "2.0.5"
Expand Down Expand Up @@ -11111,10 +11109,10 @@ lru-queue@^0.1.0:
dependencies:
es5-ext "~0.10.2"

luxon@^2.3.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-2.3.2.tgz#5f2f3002b8c39b60a7b7ad24b2a85d90dc5db49c"
integrity sha512-MlAQQVMFhGk4WUA6gpfsy0QycnKP0+NlCBJRVRNPxxSIbjrCbQ65nrpJD3FVyJNZLuJ0uoqL57ye6BmDYgHaSw==
luxon@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.0.3.tgz#573e65531efd3d92265feb640f02ba7a192e2388"
integrity sha512-+EfHWnF+UT7GgTnq5zXg3ldnTKL2zdv7QJgsU5bjjpbH17E3qi/puMhQyJVYuCq+FRkogvB5WB6iVvUr+E4a7w==

madge@^4.0.0:
version "4.0.2"
Expand Down

0 comments on commit e1c0c55

Please sign in to comment.