Skip to content

Commit b2e12ba

Browse files
committed
build: release @matheo/datepicker v11.2.14
Fix DateFnsAdapter issues
1 parent 8da5d4d commit b2e12ba

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

apps/website/src/app/demos/demos.module.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
33
import { FlexLayoutModule } from '@angular/flex-layout';
44
import { RouterModule, Routes } from '@angular/router';
55
import { MatDatepickerModule } from '@matheo/datepicker';
6-
import { MatLuxonDateModule } from '@matheo/datepicker/luxon';
6+
import { MatDateFnsModule } from '@matheo/datepicker/date-fns';
77
import { ThemeComponent } from '../shared/layout/theme/theme.component';
88
import { SharedModule } from '../shared/shared.module';
99
import { DatepickerComponent } from './components/datepicker/datepicker.component';
@@ -47,7 +47,7 @@ const routes: Routes = [
4747
FlexLayoutModule,
4848
RouterModule.forChild(routes),
4949
MatDatepickerModule,
50-
MatLuxonDateModule,
50+
MatDateFnsModule,
5151
SharedModule,
5252
],
5353
declarations: [IndexComponent, DatepickerComponent],

libs/datepicker/date-fns/date-fns-adapter.ts

+15-7
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ export class DateFnsAdapter extends DateAdapter<Date> {
191191
}
192192

193193
getHourNames(): string[] {
194-
return range(0, 24).map((i) => (i === 0 ? '00' : String(i)));
194+
return range(0, 23).map((i) => (i === 0 ? '00' : String(i)));
195195
}
196196

197197
getMinuteNames(): string[] {
198-
return range(0, 31).map((i) => String(i + 1));
198+
return range(0, 59).map(String);
199199
}
200200

201201
getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {
@@ -252,7 +252,15 @@ export class DateFnsAdapter extends DateAdapter<Date> {
252252
throw Error(`Invalid date "${date}". Date has to be greater than 0.`);
253253
}
254254

255-
const result = this._createDateWithOverflow(year, month, date);
255+
const result = this._createDateWithOverflow(
256+
year,
257+
month,
258+
date,
259+
hours,
260+
minutes,
261+
seconds,
262+
ms
263+
);
256264
// Check that the date wasn't above the upper bound for the month, causing the month to overflow
257265
if (result.getMonth() !== month) {
258266
throw Error(`Invalid date "${date}" for month with index "${month}".`);
@@ -357,10 +365,10 @@ export class DateFnsAdapter extends DateAdapter<Date> {
357365
year: number,
358366
month: number,
359367
date: number,
360-
hours?: number,
361-
minutes?: number,
362-
seconds?: number,
363-
ms?: number
368+
hours: number = 0,
369+
minutes: number = 0,
370+
seconds: number = 0,
371+
ms: number = 0
364372
): Date {
365373
const result = this._createDateInternal(
366374
year,

libs/datepicker/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@matheo/datepicker",
3-
"version": "11.2.13",
3+
"version": "11.2.14",
44
"description": "Angular material date+time picker",
55
"keywords": [
66
"angular",

0 commit comments

Comments
 (0)