You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2020/10/14 04:08:05 UTC

[incubator-echarts] branch next updated: test(time): update test case

This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/next by this push:
     new 1694130  test(time): update test case
1694130 is described below

commit 1694130f1d533a6d4c6d3e2d399061dbc65fcf8a
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Oct 14 12:06:39 2020 +0800

    test(time): update test case
---
 test/timeScale-formatter.html | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/test/timeScale-formatter.html b/test/timeScale-formatter.html
index 806eb8f..b004289 100644
--- a/test/timeScale-formatter.html
+++ b/test/timeScale-formatter.html
@@ -316,9 +316,16 @@ under the License.
                 xAxis: {
                     type: 'time',
                     axisLabel: {
-                        formatter: function (param) {
-                            const date = new Date(param.value);
-                            if (echarts.time.getUnitFromValue(param.value) === 'year') {
+                        formatter: function (value) {
+                            const date = new Date(value);
+                            const yearStart = new Date(value);
+                            yearStart.setMonth(0);
+                            yearStart.setDate(1);
+                            yearStart.setHours(0);
+                            yearStart.setMinutes(0);
+                            yearStart.setSeconds(0);
+                            yearStart.setMilliseconds(0);
+                            if (date.getTime() === yearStart.getTime()) {
                                 return '{year|' + date.getFullYear() + '}\n'
                                     + '{month|' + (date.getMonth() + 1) + '月}';
                             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org