New-UDDatePicker format

Product: PowerShell Universal
Version: 3.1.6

Hi all,

After recently updating from 2.x to 3.1.6 it seems like I can’t change the default format of a New-UDDatePicker. It’s always displaying as MM/dd/yyyy no matter what I change the -Format to.

With the date as 12th July 2022:
New-UDDatePicker -Value $thisRowDate -Format "eee, d MMM yyyy" -OnChange { = 07/12/2022
New-UDDatePicker -Value $thisRowDate -Format "dd/MM/yy" -OnChange { = 07/12/2022

Anyone else seen this?

Cheers,
Steve.

I can reproduce this and it will be fixed in 3.2.

Great! Thanks - any workaround until then? I’m hoping to release this dashboard to users in the next week or 2

like this from wsl2001…

wsl2001

Feb '21

@ZHumphries
look for new-uddatepicker function in c:\programdata\powershelluniversal\framework\3.2.7\material.ps1 file and replace the [String]$format = “MM/dd/yyyy”, with [String]$format,
and now you should be able to pass any format you like for the date.

(I’m running PSU via the .zip download in IIS)

Actually, you could do something similar.

Try those similar to those steps but change $Format to $InputFormat in both places within the file. It will be in Program Files (x86)\Universal\Modules\UniversalDashboard\UniversalDashboard.MaterialUI.psm1.

The problem is that they changed Format to InputFormat in the new version of the component.

Otherwise, v3.2 will be out next week.

1 Like

Awesome, Adam! Thank you thank you.

confirmed working after changing…

format = $Format
to
inputFormat = $Format
in the Arguments hashtable of the New-UDDatePicker function within UniversalDashboard.MaterialUI.psm1

1 Like