Closed Tuttu closed 2 years ago
International date handing is always tricky. Let me see what I can do.
For some reason, it is working correctly with the MyTask module. Are you handling dates differently? If needed, I can switch to ISO date format (yyyy-MM-dd). Would that help?
It could be related to the sqlite database. The datetime is stored as a string. When the psworkitem is created the string is treated as a [datetime] object. I may have to adjust how the string is parsed.
Got it. If needed, I'm available for testing if you don't want to bother with using a French (Or any other language) computer. :)
I think I have this figured out. I keep forgetting that PowerShell doesn't respect culture when using expansion.
I was using Get-Date
subexpressions in the SQL query which resulted in a culture mismatch.
Awesome! Good to read. :)
Cleaning up some other bugs I came across as well.
Update the module to v0.7.0 and try again. You might need to run Set-PSWorkItem
on tasks to properly update the database. Worse case, remove the tasks with "bad" dates and re-enter them.
Or, use the SQLite command to export the database to a json file.
Export-MySQLiteDB -path $PSWorkItemPath -destination dbexport.json
Edit the dates in the JSON file. Then recreate the database.
import-mySQLiteDB -Path .\dbexport.json -Destination $PSWorkItemPathgwio
Hello @jdhitsolutions,
Sorry for the late reply. I updated the module to version 0.7 and it fixed the problem without even needing to import the work items again. It looks like they are now working like a charm. 🙂
Describe the problem
I'm running a Windows 10 in French so the date time format is also in French. After adding a PSWorkItem, it is sometimes impossible to retreive it and the following error is displayed instead.
WARNING: Failed to find any matching tasks
Howerver, this does work sometimes. Example with this item. The date format is the same but the item is returned correctly.
Whether the due date is in the past or the future does not seem to matter as work items that are set both in the past or in the future either fails to be fetched or are displayed correctly.
For the record, the items have been imported from your MyTask module using the following command:
Get-Mytask | % { New-PSWorkItem -Name $_.Name -Category $_.Category -DueDate (Get-Date $_.Duedate) }
Expectation
Whatever the due date set on a PSWorkItem, it should be returned correctly independently to the date time format.
Additional Information
As stated in the title and above, I'm on a French computer. The date format is the following:
If needed, I can send you a copy of the database file.
PowerShell version
7.2
Platform
Windows 10 Pro or Enterprise
Additional Checks