Date format not displaying in tables
Hi,
I'm trying to build a table that outputs the last logon time for Active Directory Users. Here is what i've created:
##Recently Logged On Users Add-PodeWebPage -Name "Recently Logged On Users" -Group 'AD User Reports' -Icon 'account-filter' -ScriptBlock {
New-PodeWebContainer -Content @(
New-PodeWebForm -Name "Recently Logged On Users" -Content @(
$days = $WebEvent.Data['Days']
$OU = $WebEvent.Data['Select OU']
New-PodeWebSelect -Name 'Days' -Options '1','3','5','7','10','14','21','30','60','360' -SelectedValue '7'
New-PodeWebSelect -Name 'Select OU' -ScriptBlock {
(Get-ADOrganizationalUnit -Filter "*")
}
) -ScriptBlock {
$WebEvent.Data['Days']
$WebEvent.Data['Select OU']
$days = $WebEvent.Data['Days']
$OU = $WebEvent.Data['Select OU']
## Date Filter
$filter = (Get-Date).AddDays(-"$days").Date
$user = Get-ADUser -Filter * -SearchBase $OU -Property lastLogondate | Where-Object {$_.lastLogondate -ge $filter}
Update-PodeWebTable -Name 'Recently Logged On Users' -Data $user
}
New-PodeWebTable -Name 'Recently Logged On Users' -DataColumn "Name" -Compact -SimpleFilter -ScriptBlock {
}
)
#Recently Logged On Users Reports page closing tag }
The table outputs the date in the following format:
If i run the above powershell command it displays the date fine on the PS terminal.
Is there something im missing or need to update ?
Thank you
Hi @fitzwar,
This is likely down to AJAX being clever around dates, I might be able to do something on the frontend to fix this.
In the mean time, if you convert to DateTimes to strings on the backend, they should render appropriately.