Skip to content

fix(Datetime): correct days in month calculation - #17558

Merged
liamdebeasi merged 9 commits into
ionic-team:masterfrom
KillerCodeMonkey:fix/datetime-days-in-month
Mar 22, 2019
Merged

liamdebeasi merged 9 commits into
ionic-team:masterfrom
KillerCodeMonkey:fix/datetime-days-in-month

Conversation

@KillerCodeMonkey

@KillerCodeMonkey KillerCodeMonkey commented Feb 21, 2019 •

Copy link
Copy Markdown
Contributor

Short description of what this resolves:

Calculates the correct intial days in a month
Keep in mind this does not solve the issue, that valid dates are not recalculated after a month/year change (#17562)

Changes proposed in this pull request:

  • use native javascript to get days in month instead of custom leap year and day calculation

Ionic Version:
4.0.2

Fixes:
an issue as part of #16630: #17510 #16733

@liamdebeasi

Copy link
Copy Markdown
Contributor

Hi there,

Thanks for opening a PR! Would you be able to add a few tests to verify this fix? You can add them to the datetime.spec.ts file in src/components/datetime/test/. Thanks!

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

@liamdebeasi sure thing :)

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

@liamdebeasi here it comes. some simply tests for the months of this year and february of the next leap year

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 🎉

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

@liamdebeasi is there any internal agenda when you will merge these datetime prs? it is a little bit hard to keep them up to date and keep on track for external contributors 😉

@liamdebeasi

Copy link
Copy Markdown
Contributor

Hi @KillerCodeMonkey,

I plan on merging this along with your other PR since it seems like the other PR is a pre-requisite. I will look at your other PR today.

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

@liamdebeasi nice to hear that. let me know if you need something.

@liamdebeasi

Copy link
Copy Markdown
Contributor

Hey there,

Is this PR still needed now that the other datetime PR has been merged in?

Thanks!

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

@liamdebeasi you can decide. this is using native JS Dates to get days in month and does not need a leapyear check :) or ifs if a month has 30 or 31 days.

@liamdebeasi

Copy link
Copy Markdown
Contributor

Ok cool! Does it fix any particular bug, or is it just more of a style thing?

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

more of a style thing :)

@liamdebeasi

Copy link
Copy Markdown
Contributor

Ok make sense! What if we revert the changes to daysInMonth, but kept the tests? I'm not sure we need to change the daysInMonth functionality if it's already working. We can always use more tests though 🙂

@KillerCodeMonkey

Copy link
Copy Markdown
Contributor Author

Feel free to only use the tests 😋

@liamdebeasi
liamdebeasi merged commit 424879d into ionic-team:master Mar 22, 2019
@liamdebeasi

Copy link
Copy Markdown
Contributor

Thank you! 🎉

peterennis added a commit to peterennis/ionic that referenced this pull request Mar 22, 2019
test(datetime): add daysInMonth tests (ionic-team#17558)
@KillerCodeMonkey
KillerCodeMonkey deleted the fix/datetime-days-in-month branch June 17, 2019 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants