Skip to content

Commit e1c0c55

Browse files
authored
feat(material-luxon-adapter): update to luxon 3 (#25660)
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.
1 parent 0a3a556 commit e1c0c55

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"@types/fs-extra": "^9.0.13",
152152
"@types/glob": "^7.2.0",
153153
"@types/jasmine": "^4.0.0",
154-
"@types/luxon": "^1.27.0",
154+
"@types/luxon": "^3.0.0",
155155
"@types/marked": "^2.0.0",
156156
"@types/node": "^16.10.9",
157157
"@types/node-fetch": "^2.5.5",
@@ -190,7 +190,7 @@
190190
"karma-requirejs": "^1.1.0",
191191
"karma-sauce-launcher": "^4.3.6",
192192
"karma-sourcemap-loader": "^0.3.8",
193-
"luxon": "^2.3.0",
193+
"luxon": "^3.0.0",
194194
"madge": "^4.0.0",
195195
"marked": "^2.0.0",
196196
"minimatch": "^3.0.4",

src/material-luxon-adapter/adapter/luxon-date-adapter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ import {
1414
DateTimeOptions as LuxonDateTimeOptions,
1515
} from 'luxon';
1616

17-
/** Configurable options for {@see LuxonDateAdapter}. */
17+
/** Configurable options for the `LuxonDateAdapter`. */
1818
export interface MatLuxonDateAdapterOptions {
1919
/**
2020
* Turns the use of utc dates on or off.
2121
* Changing this will change how Angular Material components like DatePicker output dates.
22-
* {@default false}
2322
*/
2423
useUtc: boolean;
2524

2625
/**
2726
* Sets the first day of week.
2827
* Changing this will change how Angular Material components like DatePicker shows start of week.
29-
* {@default 0}
3028
*/
3129
firstDayOfWeek: number;
3230
}
@@ -197,7 +195,8 @@ export class LuxonDateAdapter extends DateAdapter<LuxonDateTime> {
197195
}
198196
return date
199197
.setLocale(this.locale)
200-
.toFormat(displayFormat, {timeZone: this._useUTC ? 'utc' : undefined});
198+
.setZone(this._useUTC ? 'utc' : undefined)
199+
.toFormat(displayFormat);
201200
}
202201

203202
addCalendarYears(date: LuxonDateTime, years: number): LuxonDateTime {

src/material-luxon-adapter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"peerDependencies": {
1515
"@angular/material": "0.0.0-PLACEHOLDER",
1616
"@angular/core": "0.0.0-NG",
17-
"luxon": "^2.0.0"
17+
"luxon": "^3.0.0"
1818
},
1919
"dependencies": {
2020
"tslib": "0.0.0-TSLIB"

yarn.lock

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@
254254

255255
"@angular/build-tooling@https://github.com/angular/dev-infra-private-build-tooling-builds.git#6f2cb5cf1860e75368528cf2216798db6f94d937":
256256
version "0.0.0-bf4bb09bb2d32015f71943371c7484cb845f8c33"
257-
uid "6f2cb5cf1860e75368528cf2216798db6f94d937"
258257
resolved "https://github.com/angular/dev-infra-private-build-tooling-builds.git#6f2cb5cf1860e75368528cf2216798db6f94d937"
259258
dependencies:
260259
"@angular-devkit/build-angular" "14.2.0-rc.0"
@@ -388,7 +387,6 @@
388387

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

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

37623760
"@types/marked@^2.0.0":
37633761
version "2.0.5"
@@ -11111,10 +11109,10 @@ lru-queue@^0.1.0:
1111111109
dependencies:
1111211110
es5-ext "~0.10.2"
1111311111

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

1111911117
madge@^4.0.0:
1112011118
version "4.0.2"

0 commit comments

Comments
 (0)