Skip to content

Instantly share code, notes, and snippets.

@jrgleason
Created August 5, 2014 17:43
Show Gist options
  • Save jrgleason/2fd0d73adca30bb349f8 to your computer and use it in GitHub Desktop.
Save jrgleason/2fd0d73adca30bb349f8 to your computer and use it in GitHub Desktop.
Round negative decimal in Javascript
scope.roundETD = function(etd){
var start = (etd - scope.currentDate.now())/360000;
var fixed = start.toFixed(3);
var rounded = Math.round(fixed)
return Number(rounded+"e-1");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment