@@ -166,11 +166,11 @@ exports.dateTime2ms = function(s, calendar) {
166166 // 'G' as a prefix to force the built-in gregorian calendar.
167167 var s0 = s . charAt ( 0 ) ;
168168 if ( isWorld && ( s0 === 'G' || s0 === 'g' ) ) {
169- s = s . substr ( 1 ) ;
169+ s = s . slice ( 1 ) ;
170170 calendar = '' ;
171171 }
172172
173- var isChinese = isWorld && calendar . substr ( 0 , 7 ) === 'chinese' ;
173+ var isChinese = isWorld && calendar . slice ( 0 , 7 ) === 'chinese' ;
174174
175175 var match = s . match ( isChinese ? DATETIME_REGEXP_CN : DATETIME_REGEXP ) ;
176176 if ( ! match ) return BADNUM ;
@@ -234,7 +234,7 @@ exports.isDateTime = function(s, calendar) {
234234
235235// pad a number with zeroes, to given # of digits before the decimal point
236236function lpad ( val , digits ) {
237- return String ( val + Math . pow ( 10 , digits ) ) . substr ( 1 ) ;
237+ return String ( val + Math . pow ( 10 , digits ) ) . slice ( 1 ) ;
238238}
239239
240240/**
@@ -272,7 +272,7 @@ exports.ms2DateTime = function(ms, r, calendar) {
272272 // other things for a few calendars, so we can't trust it. Just pad
273273 // it manually (after the '-' if there is one)
274274 if ( dateStr . charAt ( 0 ) === '-' ) {
275- while ( dateStr . length < 11 ) dateStr = '-0' + dateStr . substr ( 1 ) ;
275+ while ( dateStr . length < 11 ) dateStr = '-0' + dateStr . slice ( 1 ) ;
276276 } else {
277277 while ( dateStr . length < 10 ) dateStr = '0' + dateStr ;
278278 }
@@ -388,7 +388,7 @@ function modDateFormat(fmt, x, formatter, calendar) {
388388 var digits = Math . min ( + ( match . charAt ( 1 ) ) || 6 , 6 ) ;
389389 var fracSecs = ( ( x / 1000 % 1 ) + 2 )
390390 . toFixed ( digits )
391- . substr ( 2 ) . replace ( / 0 + $ / , '' ) || '0' ;
391+ . slice ( 2 ) . replace ( / 0 + $ / , '' ) || '0' ;
392392 return fracSecs ;
393393 } ) ;
394394
@@ -441,7 +441,7 @@ function formatTime(x, tr) {
441441 */
442442 var sec = Math . min ( mod ( x / ONESEC , 60 ) , MAXSECONDS [ tr ] ) ;
443443
444- var secStr = ( 100 + sec ) . toFixed ( tr ) . substr ( 1 ) ;
444+ var secStr = ( 100 + sec ) . toFixed ( tr ) . slice ( 1 ) ;
445445 if ( tr > 0 ) {
446446 secStr = secStr . replace ( / 0 + $ / , '' ) . replace ( / [ \. ] $ / , '' ) ;
447447 }
0 commit comments