Skip to content

Conversation

@timparkinson
Copy link

@timparkinson timparkinson commented Aug 5, 2017

PR Summary

Fix #4264 makes week number output compliant with ISO-8601.

PR Checklist

Copy link
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

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

@timparkinson Thanks for your contribution!

Could you please review all uformat patterns - it seems we should fix all.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we shouldn't create new object.
System.Threading.Thread.CurrentThread.CurrentCulture.Calendar

Copy link
Author

Choose a reason for hiding this comment

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

I don't believe using the CurrentCulture is appropriate in this case, because ISO 8601 is Gregorian calendar based and CurrentCulture could be set to a different calendar.

In any case further tests based on the table at https://en.wikipedia.org/wiki/ISO_week_date#Relation_with_the_Gregorian_calendar shows that my initial stab at this was incorrect, because the GetWeekOfYear does not produce the ISO 8601 output for all cases. I'll take a bit of a harder stare at this.

Copy link
Collaborator

@iSazonov iSazonov Aug 7, 2017

Choose a reason for hiding this comment

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

I believe we should follow CoreFX and should be CurrentCulture based not ISO based for all culture.
/cc @SteveL-MSFT

Copy link
Member

Choose a reason for hiding this comment

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

Agree with @iSazonov that in general, we should be using CurrentCulture. Not an expert by any means on this topic, but looking at the Wikipedia page, it seems we should implement the formula they have there?

Copy link
Collaborator

@iSazonov iSazonov Aug 14, 2017

Choose a reason for hiding this comment

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

CoreCLR already implemented this in GregorianCalendar(...)
We can use the implementation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The tests may fail if current locale is not English. So we shouldn't use explicit constants - please evaluate them.

$a=Get-Culture
$a.Calendar
...

@iSazonov
Copy link
Collaborator

@timparkinson Could you please continue?

@timparkinson
Copy link
Author

@iSazonov yes, I'm happy to continue looking at this, but I haven't had time over the last week. I may be able to spend a bit of time this weekend.

I did start looking at the other UFormats and there are definitely others that don't match the output from the Linux date command.

Would you prefer me to address them as one PR or create separate issues for each?

@iSazonov
Copy link
Collaborator

If you are limited in time you can split the work on some PRs - describe all points in one Issue and fix step by step.

@timparkinson
Copy link
Author

@iSazonov OK, I'll raise another issue detailing all the deviations from Linux behaviour in UFormat and then I'll look to fix step by step as you suggest.

I have a mini vacation after today, and will be without computer/internet - I'll hopefully be able to get to it next week.

@iSazonov
Copy link
Collaborator

/cc @SteveL-MSFT Changing UFormat looks like a breaking change - should we have the PowerShell committee's approvement?

@SteveL-MSFT SteveL-MSFT added Review - Committee The PR/Issue needs a review from the PowerShell Committee Breaking-Change breaking change that may affect users labels Aug 25, 2017
@joeyaiello
Copy link
Contributor

Backchanneled with @SteveL-MSFT, I'm good with these changes.

@SteveL-MSFT SteveL-MSFT added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Aug 25, 2017
@SteveL-MSFT
Copy link
Member

@PowerShell/powershell-committee discussed this briefly and agree the change makes sense

@iSazonov
Copy link
Collaborator

iSazonov commented Sep 4, 2017

@timparkinson Please rebase.

@timparkinson
Copy link
Author

As previously discussed, I intend to raise another issue to document all the UFormat divergences since there are several. Since this PR is incorrect anyway, I guess I should simply close it?

@iSazonov
Copy link
Collaborator

iSazonov commented Sep 4, 2017

It would be right to open the new Issue first and then decide on the fate of that PR. Currently you can rebase:

git chechout <branch>
git pull --rebase PowerShell master
git push -f

Tim Parkinson and others added 8 commits September 4, 2017 12:01
Fix PowerShell#4264 makes week number handling compliant with ISO-8601.
This reverts commit a5886cd5e419e07b884815f740e08b3c69513179.

Solution was incorrect and needs a lot more work.
Fix PowerShell#4264 makes week number handling compliant with ISO-8601.
This reverts commit a5886cd5e419e07b884815f740e08b3c69513179.

Solution was incorrect and needs a lot more work.
Fix PowerShell#4264 makes week number handling compliant with ISO-8601.
This reverts commit a5886cd5e419e07b884815f740e08b3c69513179.

Solution was incorrect and needs a lot more work.
Fix PowerShell#4264 makes week number handling compliant with ISO-8601.
This reverts commit a5886cd5e419e07b884815f740e08b3c69513179.

Solution was incorrect and needs a lot more work.
@TravisEz13
Copy link
Member

This PR appears empty. Can it be closed?

@TravisEz13 TravisEz13 changed the title Fix Get-Date -UFormat '%V' week number output Fix Get-Date -UFormat %V week number output Mar 14, 2018
@TravisEz13 TravisEz13 changed the title Fix Get-Date -UFormat %V week number output WIP: Fix Get-Date -UFormat %V week number output Mar 14, 2018
@timparkinson
Copy link
Author

Closing as well out of date.

@iSazonov iSazonov mentioned this pull request Apr 4, 2018
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking-Change breaking change that may affect users Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants