This repository was archived by the owner on Feb 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +41
-4
lines changed Expand file tree Collapse file tree 2 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ date-max-limit="" | String | false | Set a maximum date limit - you can use all
8383date-set-hidden="" | String(Boolean) | false | Set the default date to be shown only in calendar and not in the input field
8484date-disabled-dates="" | String([ Date(), Date(), ...] ) | false | Disable specific dates using an _ Array_ of dates
8585date-refocus="" | String(Boolean) | false | Set the datepicker to re-focus the input after selecting a date
86-
86+ date-typer="" | String(Boolean) | false | Set the datepicker to update calendar when is user typing a date
87+
8788##Options
8889Angular datepicker allows you to use some options via ` attribute ` data
8990
Original file line number Diff line number Diff line change 446446
447447 $scope . day = Number ( day ) ;
448448 setInputValue ( ) ;
449-
449+
450450 if ( attr . hasOwnProperty ( 'dateRefocus' ) ) {
451451 thisInput [ 0 ] . focus ( ) ;
452452 }
453-
453+
454454 $scope . hideCalendar ( ) ;
455455 }
456456 } ;
483483
484484 theNewYears . push ( Number ( startingYear ) + i ) ;
485485 }
486+ //date typing in input date-typer
487+ if ( $scope . dateTyper ) {
488+
489+ thisInput . on ( 'keyup' , function onTyping ( ) {
490+
491+ if ( thisInput [ 0 ] . value &&
492+ thisInput [ 0 ] . value . length &&
493+ thisInput [ 0 ] . value . length > 0 ) {
494+
495+ try {
496+
497+ date = new Date ( thisInput [ 0 ] . value . toString ( ) ) ;
498+
499+ if ( date . getFullYear ( ) &&
500+ date . getDay ( ) &&
501+ date . getMonth ( ) &&
502+ $scope . isSelectableDate ( date ) &&
503+ $scope . isSelectableMaxDate ( date ) &&
504+ $scope . isSelectableMinDate ( date ) ) {
486505
506+ $scope . $apply ( function applyTyping ( ) {
507+
508+ $scope . month = $filter ( 'date' ) ( date , 'MMMM' ) ; //december-November like
509+ $scope . monthNumber = Number ( $filter ( 'date' ) ( date , 'MM' ) ) ; // 01-12 like
510+ $scope . year = Number ( $filter ( 'date' ) ( date , 'yyyy' ) ) ; //2014 like
511+ setDaysInMonth ( $scope . monthNumber , $scope . year ) ;
512+ $scope . day = Number ( $filter ( 'date' ) ( date , 'dd' ) ) ; //01-31 like
513+ } ) ;
514+ }
515+ } catch ( e ) {
516+
517+ return e ;
518+ }
519+ }
520+ } ) ;
521+ }
487522 //check range dates
488523 if ( $scope . dateMaxLimit &&
489524 theNewYears &&
674709 'buttonNextTitle' : '@' ,
675710 'buttonPrevTitle' : '@' ,
676711 'dateDisabledDates' : '@' ,
677- 'dateSetHidden' : '@'
712+ 'dateSetHidden' : '@' ,
713+ 'dateTyper' : '@'
678714 } ,
679715 'link' : linkingFunction
680716 } ;
You can’t perform that action at this time.
0 commit comments