You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/01/18 13:29:42 UTC

[GitHub] [incubator-echarts] yafengstark opened a new pull request #12081: fix bug 11677 calender (Because of DST.)

yafengstark opened a new pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081
 
 
   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   <!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   
   fix bug [issue 11677](https://github.com/apache/incubator-echarts/issues/11677)
   
   deal with DST.(修复个别时区存在夏令时的问题)
   
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   
   [issue 11677](https://github.com/apache/incubator-echarts/issues/11677)
   
   
   ## Details
   see the commit.
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ## Usage
   
   ### Are there any API changes?
   
   - [ ] The API has been changed.
   
   <!-- LIST THE API CHANGES HERE -->
   
   
   
   ### Related test cases or examples to use the new APIs
   
   NA.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] echarts-bot[bot] commented on issue #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#issuecomment-575898589
 
 
   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/incubator-echarts/wiki/How-to-make-a-pull-request).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] susiwen8 commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368229577
 
 

 ##########
 File path: src/coord/calendar/Calendar.js
 ##########
 @@ -384,13 +397,20 @@ Calendar.prototype = {
         // ```
         // will get wrong result because of DST. So we should fix it.
         var date = new Date(range[0].time);
+        // 开始的时间是周几
         var startDateNum = date.getDate();
+        // 结束的时间是周几
         var endDateNum = range[1].date.getDate();
+        // 应该结尾的那一天
         date.setDate(startDateNum + allDay - 1);
         // The bias can not over a month, so just compare date.
+        // 不等,则出现DST问题。等则无DST问题
         if (date.getDate() !== endDateNum) {
-            var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
+            // sign记录调快还是调慢了。三月份那次,
+            // I only change '>' to '<'.
+            var sign = date.getTime() - range[1].time < 0 ? 1 : -1;
             while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
+                // 目的就是修改这个allday
 
 Review comment:
   Please use english

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368260436
 
 

 ##########
 File path: test/calendar-fix-11677.html
 ##########
 @@ -0,0 +1,63 @@
+
+<!--
 
 Review comment:
   Please rename this file to be `test/calendar-timezone.html` because it's hard to know from the issue id directly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368260339
 
 

 ##########
 File path: src/coord/calendar/Calendar.js
 ##########
 @@ -361,6 +361,7 @@ Calendar.prototype = {
      * @return {Object}       obj
 
 Review comment:
   If you wish to use show the structure of `range`, please do it here in the form of [jsdoc](https://jsdoc.app/tags-param.html).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368260497
 
 

 ##########
 File path: src/coord/calendar/Calendar.js
 ##########
 @@ -384,13 +397,20 @@ Calendar.prototype = {
         // ```
         // will get wrong result because of DST. So we should fix it.
         var date = new Date(range[0].time);
+        // 开始的时间是周几
         var startDateNum = date.getDate();
+        // 结束的时间是周几
         var endDateNum = range[1].date.getDate();
+        // 应该结尾的那一天
         date.setDate(startDateNum + allDay - 1);
         // The bias can not over a month, so just compare date.
+        // 不等,则出现DST问题。等则无DST问题
         if (date.getDate() !== endDateNum) {
-            var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
+            // sign记录调快还是调慢了。三月份那次,
+            // I only change '>' to '<'.
+            var sign = date.getTime() - range[1].time < 0 ? 1 : -1;
 
 Review comment:
   Can you explain why you should change this? What does `date.getTime() - range[1].time` mean?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368260151
 
 

 ##########
 File path: src/coord/calendar/Calendar.js
 ##########
 @@ -384,13 +397,20 @@ Calendar.prototype = {
         // ```
         // will get wrong result because of DST. So we should fix it.
         var date = new Date(range[0].time);
+        // 开始的时间是周几
         var startDateNum = date.getDate();
+        // 结束的时间是周几
         var endDateNum = range[1].date.getDate();
+        // 应该结尾的那一天
         date.setDate(startDateNum + allDay - 1);
         // The bias can not over a month, so just compare date.
+        // 不等,则出现DST问题。等则无DST问题
         if (date.getDate() !== endDateNum) {
-            var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
+            // sign记录调快还是调慢了。三月份那次,
+            // I only change '>' to '<'.
+            var sign = date.getTime() - range[1].time < 0 ? 1 : -1;
             while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
+                // 目的就是修改这个allday
 
 Review comment:
   Please use English for other developers to understand. Thanks!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368260476
 
 

 ##########
 File path: src/coord/calendar/Calendar.js
 ##########
 @@ -384,13 +397,20 @@ Calendar.prototype = {
         // ```
         // will get wrong result because of DST. So we should fix it.
         var date = new Date(range[0].time);
+        // 开始的时间是周几
         var startDateNum = date.getDate();
+        // 结束的时间是周几
         var endDateNum = range[1].date.getDate();
+        // 应该结尾的那一天
         date.setDate(startDateNum + allDay - 1);
         // The bias can not over a month, so just compare date.
+        // 不等,则出现DST问题。等则无DST问题
         if (date.getDate() !== endDateNum) {
-            var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
+            // sign记录调快还是调慢了。三月份那次,
+            // I only change '>' to '<'.
 
 Review comment:
   Please remove the comment of `I only change '>' to '<'.`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] yafengstark commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)

Posted by GitBox <gi...@apache.org>.
yafengstark commented on a change in pull request #12081: fix bug 11677 calender (Because of DST.)
URL: https://github.com/apache/incubator-echarts/pull/12081#discussion_r368260838
 
 

 ##########
 File path: src/coord/calendar/Calendar.js
 ##########
 @@ -384,13 +397,20 @@ Calendar.prototype = {
         // ```
         // will get wrong result because of DST. So we should fix it.
         var date = new Date(range[0].time);
+        // 开始的时间是周几
         var startDateNum = date.getDate();
+        // 结束的时间是周几
         var endDateNum = range[1].date.getDate();
+        // 应该结尾的那一天
         date.setDate(startDateNum + allDay - 1);
         // The bias can not over a month, so just compare date.
+        // 不等,则出现DST问题。等则无DST问题
         if (date.getDate() !== endDateNum) {
-            var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
+            // sign记录调快还是调慢了。三月份那次,
+            // I only change '>' to '<'.
+            var sign = date.getTime() - range[1].time < 0 ? 1 : -1;
             while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
+                // 目的就是修改这个allday
 
 Review comment:
   I use English in the newest commit. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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