fix(datetime-util): fix convertDataToISO to handle negative timezone offsets

This commit is contained in:
Andrew Mitchell
2016-07-19 15:35:36 -05:00
committed by Adam Bradley
parent 44ab527f74
commit ba53a23c6e
2 changed files with 19 additions and 3 deletions

View File

@ -390,15 +390,15 @@ export function convertDataToISO(data: DateTimeData): string {
}
function twoDigit(val: number): string {
return ('0' + (isPresent(val) ? val : '0')).slice(-2);
return ('0' + (isPresent(val) ? Math.abs(val) : '0')).slice(-2);
}
function threeDigit(val: number): string {
return ('00' + (isPresent(val) ? val : '0')).slice(-3);
return ('00' + (isPresent(val) ? Math.abs(val) : '0')).slice(-3);
}
function fourDigit(val: number): string {
return ('000' + (isPresent(val) ? val : '0')).slice(-4);
return ('000' + (isPresent(val) ? Math.abs(val) : '0')).slice(-4);
}