From: Dan Vanderkam Date: Sat, 22 Nov 2014 06:44:27 +0000 (-0500) Subject: one more X-Git-Tag: v1.1.0~15^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=refs%2Fheads%2Ffix-tests;p=dygraphs.git one more --- diff --git a/tests/value-axis-formatters.html b/tests/value-axis-formatters.html index 184101e..48d0f62 100644 --- a/tests/value-axis-formatters.html +++ b/tests/value-axis-formatters.html @@ -43,6 +43,13 @@ 1e6 * (2 - i * (100 - i) / (50 * 50))]); } + function formatDate(d) { + var yyyy = d.getFullYear(), + mm = d.getMonth() + 1, + dd = d.getDate(); + return yyyy + '-' + (mm < 10 ? '0' : '') + mm + (dd < 10 ? '0' : '') + dd; + } + g = new Dygraph( document.getElementById("demodiv"), data, @@ -59,10 +66,10 @@ axes: { x: { valueFormatter: function(ms) { - return 'xvf(' + new Date(ms).strftime('%Y-%m-%d') + ')'; + return 'xvf(' + formatDate(new Date(ms)) + ')'; }, axisLabelFormatter: function(d) { - return 'xalf(' + d.strftime('%Y-%m-%d') + ')'; + return 'xalf(' + formatDate(d) + ')'; }, pixelsPerLabel: 100, },