8000 Get-Date -UFormat "%V" returns wrong weeknumber · Issue #11534 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Get-Date -UFormat "%V" returns wrong weeknumber #11534
@paalbra

Description

@paalbra

Steps to reproduce

$date = Get-Date "2019-12-25"
while ($date -lt (Get-Date "2020-01-09")){
    Get-Date $date -UFormat '%Y-%m-%d : %V'
    $date = $date.AddDays(1)
}

Expected behavior

2019-12-25 : 52
2019-12-26 : 52
2019-12-27 : 52
2019-12-28 : 52
2019-12-29 : 52
2019-12-30 : 01
2019-12-31 : 01
2020-01-01 : 01
2020-01-02 : 01
2020-01-03 : 01
2020-01-04 : 01
2020-01-05 : 01
2020-01-06 : 02
2020-01-07 : 02
2020-01-08 : 02
2020-01-09 : 02

Actual behavior

Week number of 2020-01-03 is wrong (and other dates that trigger the same issue)

2019-12-25 : 52
2019-12-26 : 52
2019-12-27 : 52
2019-12-28 : 52
2019-12-29 : 52
2019-12-30 : 01
2019-12-31 : 01
2020-01-01 : 01
2020-01-02 : 01
2020-01-03 : 53
2020-01-04 : 01
2020-01-05 : 01
2020-01-06 : 02
2020-01-07 : 02
2020-01-08 : 02
2020-01-09 : 02

Environment data

Built of master:

PS /> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6-109-gb19e2b9d4cb65d9b705f457317d1803dea6eb150
OS                             Linux 5.4.7-200.fc31.x86_64 #1 SMP Tue Dec 31 22:25:12 UTC 2019
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0