RWS / ISHRemote

Business automation module on top of Tridion Docs Content Manager (Knowledge Center Content Manager, LiveContent Architect, Trisoft InfoShare)
Apache License 2.0
30 stars 13 forks source link

Get-IshBaselineItem parses incoming ModifiedOn and CreatedOn values using CurrentCulture instead resulting in Month Day swapping for some Regional Settings #157

Closed ddemeyer closed 9 months ago

ddemeyer commented 1 year ago

Problem... Similar issue to #137 where all <ishfield> based values were corrected, however <object> based values, typical for Baseline Items retrieval was missed. See also SRQ-22720.

$p = Get-IshPublicationOutput -LogicalId GUID-1BC6D615-95BD-420E-B654-7E299EE84C78 | Out-GridView -PassThru  # selecting one row
$bi = Get-IshBaselineItem -Id $p.fishbaseline_version_element
$bi[0].ModifiedOn
Sunday, August 6, 2023 5:23:45 PM
$bi[0].ModifiedOnAsSortableDateTime
2023-08-06T17:23:45 # which is in the future at the time of writing

Workaround... Use ([System.Globalization.CultureInfo]::CurrentCulture).DateTimeFormat.ShortDatePattern = "dd/MM/yyyy" in front of your PowerShell code. This operation will only set the ShortDatePattern for this PowerShell session, any new PowerShell session gets the system value again. It will make sure that the ISHRemote uses this CurrentCulture and parses DateTime objects correctly.

Suggested fix...