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

[QDateTime] Month 'forward' button has undesirable behaviour #847

Closed
dsl101 opened this issue Aug 31, 2017 · 2 comments
Closed

[QDateTime] Month 'forward' button has undesirable behaviour #847

dsl101 opened this issue Aug 31, 2017 · 2 comments
Milestone

Comments

@dsl101
Copy link
Contributor

dsl101 commented Aug 31, 2017

Software version

Quasar: 0.14
Browsers: Vivaldi 1.11.894.3 (Official Build) (64-bit)

What did you get as the error?

When a date picker is opened on the 31st of a month which precedes a month with only 30 days (e.g. 2017-08-31), clicking the right-arrow to move to the next month causes a jump by 2 months.

What were you expecting?

I would expect a more natural behaviour would be to jump to the last day of the next month (i.e. in this case 2017-09-30)

This problem seems to stem from the javascript implementation of setMonth(). Try this in a browser console:

d = new Date('2017-08-31')
d.getMonth()  // 7
d.setMonth(8)
d.getMonth()  // 9

I'm working on a PR for fixing this, but it's not obvious—I'm not sure quite how the setMonth() function in InlineDatetimeMat.vue works—this.month is 1–based, whereas the javascript Date().setMonth() is 0–based. Need to look closer and out of time right now.

@dsl101
Copy link
Contributor Author

dsl101 commented Sep 1, 2017

See PR #850 - I think this solves the problem both forward and backwards.

rstoenescu added a commit that referenced this issue Sep 3, 2017
Also fixed glitch in "date" utils: adjustDate, addToDate & subtractFromDate methods
rstoenescu added a commit that referenced this issue Sep 3, 2017
Also fixed glitch in "date" utils: adjustDate, addToDate & subtractFromDate methods
@rstoenescu
Copy link
Member

Decided to go with another approach, fixing some "date" utils as well.
Fix is available in latest edge version and future v0.15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants