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

Get-Date -UFormat %q does not match reference implementation #20976

Open
5 tasks done
Tracked by #20982
brianary opened this issue Dec 30, 2023 · 0 comments
Open
5 tasks done
Tracked by #20982

Get-Date -UFormat %q does not match reference implementation #20976

brianary opened this issue Dec 30, 2023 · 0 comments
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module

Comments

@brianary
Copy link
Contributor

Prerequisites

Steps to reproduce

Get-Date -UFormat %q

This is not currently implemented, but could be added as (dateTime.Month-1)/3+1 or 1+int.DivRem(dateTime.Month-1, 3).Quotient. See Date conversion specifiers or strftime.

Expected behavior

Based on running the `date -d $date +%q` as a reference implementation (see Environment for details).

PS> Get-Date 1999-01-01 -UFormat %q
1
PS> Get-Date 2000-02-14 -UFormat %q
1
PS> Get-Date 2001-03-29 -UFormat %q
1
PS> Get-Date 2002-05-12 -UFormat %q
2
PS> Get-Date 2003-06-25 -UFormat %q
2
PS> Get-Date 2004-08-07 -UFormat %q
3
PS> Get-Date 2005-09-20 -UFormat %q
3
PS> Get-Date 2006-11-03 -UFormat %q
4
PS> Get-Date 2007-12-17 -UFormat %q
4
PS> Get-Date 2009-01-29 -UFormat %q
1
PS> Get-Date 2010-03-14 -UFormat %q
1
PS> Get-Date 2011-04-27 -UFormat %q
2
PS> Get-Date 2012-06-09 -UFormat %q
2
PS> Get-Date 2013-07-23 -UFormat %q
3
PS> Get-Date 2014-09-05 -UFormat %q
3
PS> Get-Date 2015-10-19 -UFormat %q
4
PS> Get-Date 2016-12-01 -UFormat %q
4
PS> Get-Date 2018-01-14 -UFormat %q
1
PS> Get-Date 2019-02-27 -UFormat %q
1
PS> Get-Date 2020-04-11 -UFormat %q
2

Actual behavior

PS> Get-Date 1999-01-01 -UFormat %q
q
PS> Get-Date 2000-02-14 -UFormat %q
q
PS> Get-Date 2001-03-29 -UFormat %q
q
PS> Get-Date 2002-05-12 -UFormat %q
q
PS> Get-Date 2003-06-25 -UFormat %q
q
PS> Get-Date 2004-08-07 -UFormat %q
q
PS> Get-Date 2005-09-20 -UFormat %q
q
PS> Get-Date 2006-11-03 -UFormat %q
q
PS> Get-Date 2007-12-17 -UFormat %q
q
PS> Get-Date 2009-01-29 -UFormat %q
q
PS> Get-Date 2010-03-14 -UFormat %q
q
PS> Get-Date 2011-04-27 -UFormat %q
q
PS> Get-Date 2012-06-09 -UFormat %q
q
PS> Get-Date 2013-07-23 -UFormat %q
q
PS> Get-Date 2014-09-05 -UFormat %q
q
PS> Get-Date 2015-10-19 -UFormat %q
q
PS> Get-Date 2016-12-01 -UFormat %q
q
PS> Get-Date 2018-01-14 -UFormat %q
q
PS> Get-Date 2019-02-27 -UFormat %q
q
PS> Get-Date 2020-04-11 -UFormat %q
q

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

WSL Ubuntu details:

$ uname -a
Linux localhost 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Visuals

No response

@brianary brianary added the Needs-Triage The issue is new and needs to be triaged by a work group. label Dec 30, 2023
@kilasuit kilasuit added the WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module
Projects
None yet
Development

No branches or pull requests

2 participants