So @BoSen29 was the first to release his own calendar component. I released one shortly after, which allowed you to select between a start date and an end date.
It was requested by @wsl2001 and @augustin.ziegler and @mylabonline if another calendar control could be built which would also have the ability to select a time.
I have now published this component to the marketplace here:- https://marketplace.universaldashboard.io/Dashboard/UniversalDashboard.UDSelectDateTime
I even went and wrote some instructions as well, and hosted an example ps1 file here:-
So like I say this is a component for UD users, requested by UD users
Hey @abarrozo thanks for the postā¦I did notice myself the date was coming out as mm/dd/yyyy HH:mm:ss when I selected en-GB to be default locale. I was personally going to splice and dice the date format into the required but will look to improve this in the 1.0.1 release, this is a demo I put together but you could always store the $eventdata into a session variable, which would then give you the results you wanted. The demo just shows a few ways you can interact with the component. This is how I would get the results you want:-
Iām really liking this date/time picker, itās perfect for what I need. Iāve noticed that since the clocks have changed for daylight savings, the picker shows the correct time but the output itās giving is now an hour behind (Iām using the default en-GB).
@psDevUK is it statically using GMT/UTC? Do you know if there is any way to account for daylight savings?
I could get it to check if the date is between 29th March and 25th October but I just wondered if the picker had any way of doing this?
Thanks @tom.obrien for taking the time to look and use this componentā¦it is one of the very few components I am not using myself on one of my dashboardsā¦so I will have to look into thisā¦however I know @adam and @AlonGvili have so many new goodies for V3 of UD I would not be suprised if this is in V3ā¦I been snowed under supporting at my work with this whole covid-19 pandemic so will put this on the support list
No problem Iāve temporarily got around it by just taking the output and using PS to do .AddHours(1). Obviously a bit of a bodge but will tie me over for now!
Yeah I am intrigued by this nowā¦think I will dig out the demo script I got for this and take a butchers, as I am UK too so I should in theory get the same resultsā¦good to know you have a work-around, I have lots of work-arounds in life but would be good to get to the bottom of it.
The toast and the output to C:\UD\time.txt is showing me what I selectedā¦I did read older browsers not supportedā¦try the above script do you get working results like I didā¦?
Here is my proof in the pudding I am not telling fibs:-
Interesting, that does work for me too. Iām getting the value in a different way though so Iām wondering if thatās why. In your example youāre getting it with the -onchange eventdata but Iām using (Get-UDElement -id āpickerā).Attributes.StartDate. The reason I did it that way was because if the user doesnāt change the date/time then the value will be blank.
Hmmm I just looked at this in firefox then pressing F12 and went to the REACT add-on tab to inspected the āstartdateā that is held in the state of the componentā¦and when I updated it the āstartdateā updated to the same valueā¦so itās either a browser issue, I am using firefox with no problemsā¦or itās a refresh issue with the component and UD, you are using this in an endpoint yeah? Have you also used the -AutoRefresh param like I didā¦? Well I hope the script I provided will enable you to solve it within your script as you seen it does work.
Strange, I tried in both edge and chrome but got the same result. It does update when I change the date/time but itās always an hour behind. Before the clocks changed it was outputting the correct time.
I tried getting the value from the eventdata using -onchange and it does indeed return the correct value. I think I will use that method instead. Providing I null off the session variable at the end then if the box isnāt edited I can just use get-date instead for the output.
The output I get is slightly different to yours so Iām wondering if its a machine locale setting or something. Yours has āBritish Summer Timeā whereas mine has āGMT Daylight Timeā (not that there should be any difference between them!)
e.g.
Wed Apr 01 2020 19:00:00 GMT+0100 (GMT Daylight Time)
Do you know if itās possible to include UDSelectDateTime in UDInput or include in one of the UDInputField? I tried to just include the UDSelectDateTime under UDInput, it did not appear. The existing UDInputField for date & time does not look good.
You could use it outside of the input but on the new UD action reference the ID and the attribute value to obtain the data. I hope this makes sense on atm
It seems the selected datetime is 2 hours behind (server is under CET timezone) - I think it generated standard GMT time. I added +2 hours in the output attributes value. The eventdata is showing browser/clients correct datetime though. To fix this, I added AddHours(2) in ((Get-UDElement -id āPickerā).Attributes.startDate).Addhours(2)
Anyway, how do you align the time container nicely?