This is an automated email from the ASF dual-hosted git repository. wangzx pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/echarts-doc.git
The following commit(s) were added to refs/heads/master by this push: new 5716bc6e fix: update deprecated usage of `echarts.time.parse/format` 5716bc6e is described below commit 5716bc6ee26c823d86e04a65a02f28d9703f3f3f Author: plainheart <y...@all-my-life.cn> AuthorDate: Mon Oct 10 15:53:39 2022 +0800 fix: update deprecated usage of `echarts.time.parse/format` --- en/option/component/axisPointer.md | 4 ++-- en/option/partial/2d-data.md | 2 +- zh/option/component/axisPointer.md | 4 ++-- zh/option/component/calendar.md | 8 ++++---- zh/option/partial/2d-data.md | 2 +- zh/tutorial/calendar-example.md | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/en/option/component/axisPointer.md b/en/option/component/axisPointer.md index 273e4a8e..e03ce456 100644 --- a/en/option/component/axisPointer.md +++ b/en/option/component/axisPointer.md @@ -71,11 +71,11 @@ link: [{ mapper: function (sourceVal, sourceAxisInfo, targetAxisInfo) { if (sourceAxisInfo.axisName === 'yy') { // from timestamp to '2012-02-05' - return echarts.format.formatTime('yyyy-MM-dd', sourceVal); + return echarts.time.format('yyyy-MM-dd', sourceVal); } else if (targetAxisInfo.axisName === 'yy') { // from '2012-02-05' to date - return echarts.number.parseDate(dates[sourceVal]); + return echarts.time.parse(dates[sourceVal]); } else { return sourceVal; diff --git a/en/option/partial/2d-data.md b/en/option/partial/2d-data.md index 0a0331e6..aad2ca33 100644 --- a/en/option/partial/2d-data.md +++ b/en/option/partial/2d-data.md @@ -139,7 +139,7 @@ series: [{ + a JavaScript Date instance created by user: + Caution, when using a data string to create a Date instance, [browser differences and inconsistencies](https://dygraphs.com/date-formats.html) should be considered. + For example: In chrome, `new Date('2012-01-01')` is treated as a Jan 1st 2012 in UTC, while `new Date('2012-1-1')` and `new Date('2012/01/01')` are treated as Jan 1st 2012 in local timezone. In safari `new Date('2012-1-1')` is not supported. - + So if you intent to perform `new Date(dateString)`, it is strongly recommended to use a time parse library (e.g., [moment](https://momentjs.com/)), or use `echarts.number.parseDate`, or check [this](https://dygraphs.com/date-formats.html). + + So if you intent to perform `new Date(dateString)`, it is strongly recommended to use a time parse library (e.g., [moment](https://momentjs.com/)), or use `echarts.time.parse`, or check [this](https://dygraphs.com/date-formats.html). diff --git a/zh/option/component/axisPointer.md b/zh/option/component/axisPointer.md index 1a62a960..5c319621 100644 --- a/zh/option/component/axisPointer.md +++ b/zh/option/component/axisPointer.md @@ -176,11 +176,11 @@ link: [{ mapper: function (sourceVal, sourceAxisInfo, targetAxisInfo) { if (sourceAxisInfo.axisName === 'yy') { // from timestamp to '2012-02-05' - return echarts.format.formatTime('yyyy-MM-dd', sourceVal); + return echarts.time.format('yyyy-MM-dd', sourceVal); } else if (targetAxisInfo.axisName === 'yy') { // from '2012-02-05' to date - return echarts.number.parseDate(dates[sourceVal]); + return echarts.time.parse(dates[sourceVal]); } else { return sourceVal; diff --git a/zh/option/component/calendar.md b/zh/option/component/calendar.md index 5b556b6d..4559fe57 100644 --- a/zh/option/component/calendar.md +++ b/zh/option/component/calendar.md @@ -46,10 +46,10 @@ --- <ExampleBaseOption name="calendar" title="日历图" title-en="Calendar"> -function getVirtulData(year) { +function getVirtualData(year) { year = year || '2017'; - var date = +new Date(year + '-01-01'); - var end = +new Date((+year + 1) + '-01-01'); + var date = +new Date(year + '/01/01'); + var end = +new Date((+year + 1) + '/01/01'); var dayTime = 3600 * 24 * 1000; var data = []; for (var time = date; time < end; time += dayTime) { @@ -88,7 +88,7 @@ const option = { series: { type: 'heatmap', coordinateSystem: 'calendar', - data: getVirtulData(2016) + data: getVirtualData(2016) } }; </ExampleBaseOption> diff --git a/zh/option/partial/2d-data.md b/zh/option/partial/2d-data.md index b00d57f7..b302828a 100644 --- a/zh/option/partial/2d-data.md +++ b/zh/option/partial/2d-data.md @@ -135,7 +135,7 @@ series: [{ + 或者用户自行初始化的 Date 实例: + 注意,用户自行初始化 Date 实例的时候,[浏览器的行为有差异,不同字符串的表示也不同](https://dygraphs.com/date-formats.html)。 + 例如:在 chrome 中,`new Date('2012-01-01')` 表示 UTC 时间的 2012 年 1 月 1 日,而 `new Date('2012-1-1')` 和 `new Date('2012/01/01')` 表示本地时间的 2012 年 1 月 1 日。在 safari 中,不支持 `new Date('2012-1-1')` 这种表示方法。 - + 所以,使用 `new Date(dataString)` 时,可使用第三方库解析(如 [moment](https://momentjs.com/)),或者使用 `echarts.number.parseDate`,或者参见 [这里](https://dygraphs.com/date-formats.html)。 + + 所以,使用 `new Date(dataString)` 时,可使用第三方库解析(如 [moment](https://momentjs.com/)),或者使用 `echarts.time.parse`,或者参见 [这里](https://dygraphs.com/date-formats.html)。 **当需要对个别数据进行个性化定义时:** diff --git a/zh/tutorial/calendar-example.md b/zh/tutorial/calendar-example.md index d570c2c5..4f7c916d 100644 --- a/zh/tutorial/calendar-example.md +++ b/zh/tutorial/calendar-example.md @@ -74,10 +74,10 @@ myChart.setOption(option); var myChart = echarts.init(document.getElementById('main')); // 模拟数据 - function getVirtulData(year) { + function getVirtualData(year) { year = year || '2017'; - var date = +echarts.number.parseDate(year + '-01-01'); - var end = +echarts.number.parseDate(year + '-12-31'); + var date = +echarts.time.parse(year + '-01-01'); + var end = +echarts.time.parse(year + '-12-31'); var dayTime = 3600 * 24 * 1000; var data = []; for (var time = date; time <= end; time += dayTime) { @@ -100,7 +100,7 @@ myChart.setOption(option); series: { type: 'heatmap', coordinateSystem: 'calendar', - data: getVirtulData(2017) + data: getVirtualData(2017) } }; myChart.setOption(option); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org