Skip to content

Commit

Permalink
start to fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jpomfret committed May 18, 2024
1 parent 22c7bc9 commit d290c4a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions public/ConvertTo-DbaDataTable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ function ConvertTo-DbaDataTable {
}
$specialType = 'Size'
} elseif ($type -eq 'Dataplat.Dbatools.Utility.DbaDateTime') {
$special = $true
$value = [System.DateTime]$value.DateTime
$type = 'System.DateTime'
$specialType = 'DateTime'
if (-not ($null -eq $value.DateTime)) {
$special = $true
$value = [System.DateTime]$value.DateTime
$type = 'System.DateTime'
$specialType = 'DateTime'
}
} elseif (-not ($type -in $types)) {
# All types which are not found in the array will be converted into strings.
# In this way we don't ignore it completely and it will be clear in the end why it looks as it does.
Expand Down Expand Up @@ -204,7 +206,7 @@ function ConvertTo-DbaDataTable {
[CmdletBinding()]
param (
$Value,
[ValidateSet('Timespan', 'Size')]
[ValidateSet('Timespan', 'Size','DateTime')]
[string]$Type,
[string]$SizeType,
[string]$TimeSpanType
Expand Down

0 comments on commit d290c4a

Please sign in to comment.