ugit icon indicating copy to clipboard operation
ugit copied to clipboard

`git log -Since <date>` should support `git.exe` dates like `1week`

Open ninmonkey opened this issue 6 months ago • 0 comments

Named git dates like 1week, 3months, etc will fail when used by ugit -Since <date> Because the strings fail coercing on parameterbinding as [datetime]

throw when used with git -Since <date> Dates like 1week work for git.exe --since <date>

Expected Behavior: Like git.exe

> git.exe log --since 1week # 👍 works

Behavior ugit

# 👍 works
> git log -Since ( [datetime]::Now.AddDays(-7) )

# 🔴 Errors
> git log -Since 1week
Cannot process argument transformation on parameter 'After'. Cannot convert value "1week" to type "System.DateTime". Error: "The string '1week' was not recognized as a valid DateTime. There is an unknown word starting at index '1'."

Fix

I could write a PR if you know where in the docs git.exe defines valid <dates>. I did not have luck googling. I thought maybe the datatype could stay as a [datetime] if an ArgumentTransformation first converts the strings to datetime? ( I'd have to test whether binding and transform requires the type to be [object] or not -- in pwsh )

ninmonkey avatar Jul 27 '24 15:07 ninmonkey