File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,25 @@ export const updateDuration = ({
114
114
if ( newValue > 86399000 ) {
115
115
newValue = 86399000 ;
116
116
}
117
+
118
+ // stopTime must not be equal to 24:00:00, so when the user types 23:59:59 in the startTime field and stopTime field -
119
+ // set the startTime field to 23:59:58.
120
+ if ( index === 'stopTime' && duration . startTime === 86399000 ) {
121
+ const startTime = 86399000 - 1000 ;
122
+
123
+ setUnsavedDuration ( {
124
+ startTime : module . durationStringFromValue ( startTime ) ,
125
+ stopTime : module . durationStringFromValue ( newValue ) ,
126
+ } ) ;
127
+ setDuration ( {
128
+ ...duration ,
129
+ startTime,
130
+ stopTime : newValue ,
131
+ } ) ;
132
+
133
+ return ;
134
+ }
135
+
117
136
// stopTime must be at least 1 second, if not zero
118
137
if ( index === 'stopTime' && newValue > 0 && newValue < 1000 ) {
119
138
newValue = 1000 ;
Original file line number Diff line number Diff line change @@ -258,6 +258,26 @@ describe('Video Settings DurationWidget hooks', () => {
258
258
} ) ;
259
259
} ) ;
260
260
} ) ;
261
+ describe ( 'if the passed stopTime = startTime' , ( ) => {
262
+ it ( 'sets the startTime value less than stopTime value' , ( ) => {
263
+ testMethod ( {
264
+ ...props ,
265
+ duration : { startTime : 86399000 , stopTime : 86399000 } ,
266
+ unsavedDuration : { startTime : '23:59:59' , stopTime : '23:59:59' } ,
267
+ index : testStopIndex ,
268
+ inputString : '23:59:59' ,
269
+ } ) ;
270
+ expect ( props . setUnsavedDuration ) . toHaveBeenCalledWith ( {
271
+ startTime : '23:59:58' ,
272
+ stopTime : '23:59:59' ,
273
+ } ) ;
274
+ expect ( props . setDuration ) . toHaveBeenCalledWith ( {
275
+ ...props . duration ,
276
+ startTime : 86399000 - 1000 ,
277
+ stopTime : 86399000 ,
278
+ } ) ;
279
+ } ) ;
280
+ } ) ;
261
281
} ) ;
262
282
describe ( 'onDurationChange' , ( ) => {
263
283
beforeEach ( ( ) => {
You can’t perform that action at this time.
0 commit comments