Ive logged this on github already, but thought I should check here first in case I was doing something stupid, or had missed the blindingly obvious.
Whenever I try to set the value (with -value) of a New-UDDataPicker to anything over the 12th of the month it errors with Invalid Date Format. Im assuming this is a bug to with the way it handles time formats.
Does anyone have any ideas of how this can be handled when you need to pre-populate the date picker?
@ZHumphries
i have found a fix so far that worked and show the format as you want “MM/dd/yyyy” or “dd/MM/yyyy”
let me know if you still need assistant and ill post how to apply the fix.
@psDevUK
I thought I would give your New-UDSelectDateTime a go and see if that helped at all. Unfortunately it seems to be generating a RangeError when used in a form (works fine with normal [datetimes] otherwise). Can you see anything wrong with this (Hopefully im missing something wonderfully obvious)?
New-UDDashboard -Title 'NotificationDatePicker' -Content {
New-UDSelectDateTime -Id 'NotificationDatePicker' # Works
New-UDForm -Content {
New-UDSelectDateTime -Id 'NotificationDatePicker' # Error (There was an error rendering component of type UD-SelectDateTime. RangeError: Invalid time value)
} -OnSubmit {}
}
Hello @ZHumphries thanks for giving my module a shot. I didn’t test this inside the New-UDForm however you could just add a button and get the values from that, or use the suggestion @wsl2001 has given. Or if you place it outside the New-UDForm but within the -OnSubmit read the values from the ID of the component that should work, but not sure how many other things you have on your form? I mean I have built a ton of components, I do have field text box components, then use them and a custom buttom for the submit…guess the easier option is to follow @wsl2001 advice
@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 know its been a while but im getting the same issue with New-UDDatePicker, has anyone managed to find a workaround?
I have tried replacing [String]$format = “MM/dd/yyyy”, with [String]$format but that doesnt work either.