I've been struggling with the DateTimePicker in a workflow. I'm
basically trying to have a simple control that allows changing/setting
of a user's login expiration time from within a PRD. I had done this in
the past with l little problem, but it has been a while and last time I
did this I used form.dateToString to set the value in the
DateTimePicker. After finding out that no longer works in current
versions of the UserApp, I switched to the following:

document.getElementById('_loginExpirationTime').va lue=new
Date(convertedTime).toString('M/d/yyyy h:mm tt');

Where loginExpirationTime is a DateTimePicker control on my form and
convertedTime is the eDir time (e.g. 20170127050000Z) converted to a
Javascript Date reference. I used this routine I found elsewhere on the
forums to covert it:


function convertToDate(str) {
str = str + '';
var year = str.substring(0, 4);
var month = str.substring(4, 6);
var day = str.substring(6, 8);
var hour = str.substring(8, 10);
var minute = str.substring(10, 12);
var second = str.substring(12, 14);
var _date = new Date();
// Set date parts
// Return the date object
return _date;
catch ( e ) {
alert( 'Error: ' + e.description);
return new Date();


This all works perfectly, except for one particular scenario.

If the user's expiration time is at MIDNIGHT (or really any time during
the midnight hour) I cannot submit/save the user since it fails the
field validation.

What I noticed is that if I pick a date using the control, midnight
comes up as 12:00 AM, but when I READ the value form eDir, and CONVERT
using the route above function, the value that gets set on the control
is 0:00 AM, NOT 12:00 AM. So in this case, the validation fails as

Login Expiration Time: date is invalid. Please use this format: M/d/yyyy
h:mm tt.

Everything other time works fine. Unfortunately, this is going to be an
issue since the time/date picker always defaults to midnight.

I thought about bypassing/overriding the validation checking, but I'd
rather not do that. Is there any way to tweak the conversion so that it
will return midnight as 12:00 AM and not 0:00 AM?

Another lousy hack I thought about was just never allowing the midnight
hour and pushing it back or forward one hour.



P.S. This is IdM 4.5.5 revision 978

matt's Profile: https://forums.netiq.com/member.php?userid=183
View this thread: https://forums.netiq.com/showthread.php?t=57204