[DEV-5546] Move edge case code for month
parent
716f2b1a32
commit
c55235d7d4
|
@ -270,6 +270,13 @@ exports.relativeDate = function( data, value )
|
||||||
// months
|
// months
|
||||||
case 'm':
|
case 'm':
|
||||||
date_new.setMonth( date_new.getMonth() + +tval );
|
date_new.setMonth( date_new.getMonth() + +tval );
|
||||||
|
// when adding a month to the last day of the month
|
||||||
|
// make sure the new date is also the last day of the month
|
||||||
|
// and not the first day of the next
|
||||||
|
if( date_new.getUTCDate() !== now_day )
|
||||||
|
{
|
||||||
|
date_new.setUTCDate(0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// days
|
// days
|
||||||
|
@ -286,14 +293,6 @@ exports.relativeDate = function( data, value )
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// when adding a month to the last day of the month
|
|
||||||
// make sure the new date is also the last day of the month
|
|
||||||
// and not the first day of the next
|
|
||||||
if( type === 'm' && date_new.getUTCDate() !== now_day )
|
|
||||||
{
|
|
||||||
date_new.setUTCDate(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// return in the YYYY-MM-DD format, since that's what our fields are
|
// return in the YYYY-MM-DD format, since that's what our fields are
|
||||||
// formatted as
|
// formatted as
|
||||||
return date_new.getFullYear() + '-'
|
return date_new.getFullYear() + '-'
|
||||||
|
|
Loading…
Reference in New Issue