@@ -413,34 +413,46 @@ export class JBDateInputWebComponent extends HTMLElement {
413
413
this . #setMaxDate( maxDate ) ;
414
414
}
415
415
}
416
- #setMinDate( dateString : string ) {
416
+ setMinDate ( minDate : string | Date ) {
417
+ this . #setMinDate( minDate ) ;
418
+ }
419
+ #setMinDate( dateInput : string | Date ) {
417
420
let minDate : Date | null = null ;
418
421
//create min date base on input value type
419
- minDate = this . #dateFactory. getDateFromValueDateString ( dateString ) ;
422
+ if ( typeof dateInput == "string" ) {
423
+ minDate = this . #dateFactory. getDateFromValueDateString ( dateInput ) ;
424
+ } else {
425
+ minDate = dateInput ;
426
+ }
420
427
if ( minDate ) {
421
428
this . dateRestrictions . min = minDate ;
422
429
if ( this . elements . calendar . dateRestrictions ) {
423
430
this . elements . calendar . dateRestrictions . min = minDate ;
424
431
}
425
432
} else {
426
- console . error ( `min date ${ dateString } is not valid and it will be ignored` , '\n' , 'please provide min date in format : ' + this . #dateFactory. valueFormat ) ;
433
+ console . error ( `min date ${ dateInput } is not valid and it will be ignored` , '\n' , 'please provide min date in format : ' + this . #dateFactory. valueFormat ) ;
427
434
}
428
435
429
436
}
430
- #setMaxDate( dateString : string ) {
437
+ setMaxDate ( maxDate : string | Date ) {
438
+ this . #setMaxDate( maxDate ) ;
439
+ }
440
+ #setMaxDate( dateInput : string | Date ) {
431
441
let maxDate : Date | null = null ;
432
442
//create max date base on input value type
433
- maxDate = this . #dateFactory. getDateFromValueDateString ( dateString ) ;
443
+ if ( typeof dateInput == "string" ) {
444
+ maxDate = this . #dateFactory. getDateFromValueDateString ( dateInput ) ;
445
+ } else {
446
+ maxDate = dateInput ;
447
+ }
434
448
if ( maxDate ) {
435
449
this . dateRestrictions . max = maxDate ;
436
450
if ( this . elements . calendar . dateRestrictions ) {
437
451
this . elements . calendar . dateRestrictions . max = maxDate ;
438
452
}
439
453
} else {
440
- console . error ( `max date ${ dateString } is not valid and it will be ignored` , '\n' , 'please provide max date in format : ' + this . #dateFactory. valueFormat ) ;
454
+ console . error ( `max date ${ dateInput } is not valid and it will be ignored` , '\n' , 'please provide max date in format : ' + this . #dateFactory. valueFormat ) ;
441
455
}
442
-
443
-
444
456
}
445
457
inputChar ( char : string , pos : number ) {
446
458
if ( pos == 4 || pos == 7 ) {
0 commit comments