]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Refactored * 100 / 100 to toFixed(2) 684/head
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 19 Mar 2013 06:26:03 +0000 (23:26 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 30 Mar 2013 06:18:25 +0000 (23:18 -0700)
test/moment/duration.js

index edf3ce86ef1f307e7a89a71f9a986f404e5ac826..9ec13b83d02d2e360290fc5cb8e3c02d43272838 100644 (file)
@@ -191,14 +191,14 @@ exports.duration = {
         });
 
         test.expect(8);
-        test.equal(Math.round(d.asYears() * 100) / 100,   2.29,        "years");
-        test.equal(Math.round(d.asMonths() * 100) / 100,  27.51,       "months");
-        test.equal(Math.round(d.asWeeks() * 100) / 100,   119.33,      "weeks");
-        test.equal(Math.round(d.asDays() * 100) / 100,    835.34,      "days");
-        test.equal(Math.round(d.asHours() * 100) / 100,   20048.16,    "hours");
-        test.equal(Math.round(d.asMinutes() * 100) / 100, 1202889.33,  "minutes");
-        test.equal(Math.round(d.asSeconds() * 100) / 100, 72173360.01, "seconds");
-        test.equal(d.asMilliseconds(),                    72173360012, "milliseconds");
+        test.equal(d.asYears().toFixed(2),          "2.29", "years");
+        test.equal(d.asMonths().toFixed(2),        "27.51", "months");
+        test.equal(d.asWeeks().toFixed(2),        "119.33", "weeks");
+        test.equal(d.asDays().toFixed(2),         "835.34", "days");
+        test.equal(d.asHours().toFixed(2),      "20048.16", "hours");
+        test.equal(d.asMinutes().toFixed(2),  "1202889.33", "minutes");
+        test.equal(d.asSeconds().toFixed(2), "72173360.01", "seconds");
+        test.equal(d.asMilliseconds(),         72173360012, "milliseconds");
         test.done();
     },