@@ -79,10 +79,20 @@ export const OPTIONS_ISO_DATE: TimeEditorOptions = {
7979 twoDigitYear : false
8080} ;
8181
82+ export const OPTIONS_ISO_TIME : TimeEditorOptions = {
83+ dateTimeStyle : DateTimeStyle . TIME_ONLY ,
84+ decimal : '.' ,
85+ hourStyle : HourStyle . HOURS_24 ,
86+ numbering : 'latn' ,
87+ showSeconds : true ,
88+ timeFieldSeparator : ':' ,
89+ } ;
90+
8291const namedOptions : Record < string , TimeEditorOptions > = {
8392 date_only : OPTIONS_DATE_ONLY ,
8493 iso : OPTIONS_ISO ,
85- iso_date : OPTIONS_ISO_DATE
94+ iso_date : OPTIONS_ISO_DATE ,
95+ iso_time : OPTIONS_ISO_TIME
8696} ;
8797
8898type TimeFormat = 'date' | 'time' | 'datetime-local' ;
@@ -1395,8 +1405,37 @@ export class TimeEditorComponent extends DigitSequenceEditorDirective<number> im
13951405
13961406 if ( newValue !== origValue || this . outOfRange ) {
13971407 i [ sel ] . value = newValue ;
1408+ let wallTime = this . getWallTimeFromDigits ( ) ;
1409+
1410+ if ( this . yearIndex >= 0 &&
1411+ ( sel === this . signIndex || ( this . yearIndex <= sel && sel < this . yearIndex + this . yearDigits ) ) ) {
1412+ const yi = this . yearIndex ;
1413+ const yd = this . yearDigits ;
1414+ const len = sel - yi + 2 ;
1415+ const yv = this . getDigits ( yi , yd ) ;
1416+ const yp = ( ( yv >= 0 ? '+' : '-' ) + abs ( yv ) . toString ( ) . padStart ( yd , '0' ) ) . substring ( 0 , len ) ;
1417+ let yearTarget : number ;
1418+ let timeTarget : number | DateAndTime ;
1419+
1420+ if ( this . minLimit . year != null && wallTime . y < this . minLimit . year ) {
1421+ yearTarget = this . minLimit . year ;
1422+ timeTarget = this . minLimit . wallTime ?? this . minLimit . utc ;
1423+ }
1424+ else if ( this . maxLimit . year != null && wallTime . y > this . maxLimit . year ) {
1425+ yearTarget = this . maxLimit . year ;
1426+ timeTarget = this . maxLimit . wallTime ?? this . maxLimit . utc ;
1427+ }
1428+
1429+ if ( yearTarget != null ) {
1430+ const tp = ( ( yearTarget >= 0 ? '+' : '-' ) + abs ( yearTarget ) . toString ( ) . padStart ( yd , '0' ) ) . substring ( 0 , len ) ;
1431+
1432+ if ( yp === tp ) {
1433+ this . updateDigits ( new DateTime ( timeTarget , this . timezone ) ) ;
1434+ wallTime = this . getWallTimeFromDigits ( ) ;
1435+ }
1436+ }
1437+ }
13981438
1399- const wallTime = this . getWallTimeFromDigits ( ) ;
14001439 const wasLeap = ( this . _tai && wallTime . sec >= 60 ) ;
14011440 let extraSec = ( wasLeap ? 1 : 0 ) ;
14021441
0 commit comments