Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule.prototype.setAllDayPeriod logic #662

Closed
lhysdl opened this issue Jul 22, 2020 · 4 comments
Closed

Schedule.prototype.setAllDayPeriod logic #662

lhysdl opened this issue Jul 22, 2020 · 4 comments
Assignees
Labels
Enhancement Enhance performance or improve usability of original features. Question To Do

Comments

@lhysdl
Copy link

lhysdl commented Jul 22, 2020

Summary

Schedule.prototype.setAllDayPeriod = function(start, end) {
    // If it is an all-day schedule, only the date information of the string is used.
    if (util.isString(start)) {
        start = datetime.parse(start.substring(0, 10));
    } else {
        start = new TZDate(start || Date.now());
    }
    if (util.isString(end)) {
        end = datetime.parse(end.substring(0, 10));
    } else {
        end = new TZDate(end || this.start);
    }

    this.start = start;
    this.start.setHours(0, 0, 0);
    this.end = end || new TZDate(this.start);
    this.end.setHours(23, 59, 59);
};

I don't understand why to use if (util.isString(start)) { start = datetime.parse(start.substring(0, 10)); } to deal with string arg as a special case, becausenew TZDate()accept string arg.

in my case, I store start-date value as json date, for example ''2020-07-06T16:00:00.000Z'' (my timezone is +8)
datetime.parse(start.substring(0, 10))
will give me 2020-07-06 as the start-date, which is not what I want.
new TZDate(start)give me the right date which is 2020-07-07.

As summary, datetime.parse(start.substring(0, 10)) will not consider timezone like new TZDate(start) do, which lead to logical inconsistency.

Version

1.12.13

@auto-comment
Copy link

auto-comment bot commented Jul 22, 2020

Thank you for raising an issue.
We will try and get back to you as soon as possible.

Please make sure you have filled out issue respecting our form in English and given us as much context as possible. If not, the issue will be closed or not replied.

@jungeun-cho jungeun-cho self-assigned this Jul 23, 2020
@jungeun-cho jungeun-cho added Enhancement Enhance performance or improve usability of original features. To Do labels Jul 23, 2020
@jungeun-cho
Copy link
Contributor

I understand. It needs to be improved.

@lhysdl
Copy link
Author

lhysdl commented Jul 23, 2020

@jungeun-cho can I make a PR to fix it?

@jungeun-cho
Copy link
Contributor

Of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhance performance or improve usability of original features. Question To Do
Projects
None yet
Development

No branches or pull requests

2 participants