[MediaWiki-commits] [Gerrit] Fixed wrong decade precision - change (mediawiki...DataValues)
Tobias Gritschacher has uploaded a new change for review. https://gerrit.wikimedia.org/r/64790 Change subject: Fixed wrong decade precision .. Fixed wrong decade precision Bug: 48673 Change-Id: Ic819a280783ac0afe261988b913d14ee0d57c061 --- M DataValues/resources/time.js/src/time.js 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues refs/changes/90/64790/1 diff --git a/DataValues/resources/time.js/src/time.js b/DataValues/resources/time.js/src/time.js index 116d593..d97cabe 100644 --- a/DataValues/resources/time.js/src/time.js +++ b/DataValues/resources/time.js/src/time.js @@ -146,8 +146,16 @@ }; var writeApproximateYear = function( year, precision ) { - var significant = Math.floor( (Math.abs( year ) - 1) / Math.pow( 10, 9 - precision ) ) + 1, - text = settings.outputprecision[precision].replace( '%', significant ); + var significant = 0, + text = ''; + + if( precision == 8 ) { + significant = Math.floor( (Math.abs( year ) ) / Math.pow( 10, 9 - precision ) ); + } else { + significant = Math.floor( (Math.abs( year ) - 1) / Math.pow( 10, 9 - precision ) ) + 1; + } + + text = settings.outputprecision[precision].replace( '%', significant ); if( precision < 6 ) { if( year < 0 ) { @@ -160,6 +168,7 @@ text += ' ' + settings.bce[0]; } } + return text; }; -- To view, visit https://gerrit.wikimedia.org/r/64790 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic819a280783ac0afe261988b913d14ee0d57c061 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DataValues Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed wrong decade precision - change (mediawiki...DataValues)
Denny Vrandecic has submitted this change and it was merged. Change subject: Fixed wrong decade precision .. Fixed wrong decade precision Bug: 48673 Change-Id: Ic819a280783ac0afe261988b913d14ee0d57c061 --- M DataValues/resources/time.js/src/time.js 1 file changed, 11 insertions(+), 2 deletions(-) Approvals: Denny Vrandecic: Looks good to me, approved jenkins-bot: Verified diff --git a/DataValues/resources/time.js/src/time.js b/DataValues/resources/time.js/src/time.js index 116d593..74fc6bd 100644 --- a/DataValues/resources/time.js/src/time.js +++ b/DataValues/resources/time.js/src/time.js @@ -146,8 +146,16 @@ }; var writeApproximateYear = function( year, precision ) { - var significant = Math.floor( (Math.abs( year ) - 1) / Math.pow( 10, 9 - precision ) ) + 1, - text = settings.outputprecision[precision].replace( '%', significant ); + var significant = 0, + text = ''; + + if( precision == 8 ) { + significant = Math.floor( ( Math.abs( year ) ) / Math.pow( 10, 9 - precision ) ); + } else { + significant = Math.floor( ( Math.abs( year ) - 1) / Math.pow( 10, 9 - precision ) ) + 1; + } + + text = settings.outputprecision[precision].replace( '%', significant ); if( precision < 6 ) { if( year < 0 ) { @@ -160,6 +168,7 @@ text += ' ' + settings.bce[0]; } } + return text; }; -- To view, visit https://gerrit.wikimedia.org/r/64790 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic819a280783ac0afe261988b913d14ee0d57c061 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/DataValues Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher Gerrit-Reviewer: Denny Vrandecic Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits