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

fix(ion-datetime): keep the model value consistently an ISO string #15907

Merged
merged 3 commits into from
Oct 11, 2018

Conversation

kensodemann
Copy link
Member

Short description of what this resolves:

Keep the value property consistently an ISO date string.

NOTE: this is an alternate approach to PR #15833

Changes proposed in this pull request:

  • start implementing unit tests
  • keep the value consistently the ISO date format
  • the full date format is still in this.datetimeValue and is updated when the value property changes or when a new date is picked from the picker

Ionic Version: 4.x

Fixes: #15408

@ghenry22
Copy link

Thanks for looking into this, would be great to get this merged in an upcoming release!

@@ -356,7 +356,7 @@ export function convertDataToISO(data: DatetimeData): string {

} else {
// YYYY-MM-DDTHH:mm:SS+/-HH:mm
rtn += (data.tzOffset > 0 ? '+' : '-') + twoDigit(Math.floor(data.tzOffset / 60)) + ':' + twoDigit(data.tzOffset % 60);
rtn += (data.tzOffset > 0 ? '+' : '-') + twoDigit(Math.floor(Math.abs(data.tzOffset / 60))) + ':' + twoDigit(data.tzOffset % 60);
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this fix? do we need Math.floor() then? Math.round should return an integer already

Copy link
Member Author

Choose a reason for hiding this comment

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

For negative numbers, -7.15 would floor() to -8, but we need it to be -7. See the 'appends a partial hour negative offset timezone' test. That would be -08:15 w/o this change but -435 minutes is -07:15

@kensodemann kensodemann merged commit b46052b into master Oct 11, 2018
@kensodemann kensodemann deleted the fix/ionDateTimeInternal branch October 11, 2018 21:50
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.

3 participants