Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Anonymous_User Absent Member.
Absent Member.
315 views

HPD Dates


Hi,

Started to move some workflows from an old 4.02 installation that works
nicely in production to an Test system with the new HPD .

I started out with cleaning out the forms from scripts and attributes
not needed for this exercise, deployed and tried it.

Then I got into the same error as others before me, date picker is
changed.

I have seen two questions about the problem (in the same thread) but no
answer.

I do this in an onload event on a date field:

var s = new Date().getTime();
form.setValues("enabledate",form.dateToString(new Date(s), true));


Any suggestions on how to change this code to working?

Thanks
Joakim


In the other thread this was the question, same error:

Hi,

If I try to set a date in the datepicker field with this code from the
402 documentation:

dateToString()
form.dateToString(date)
form.dateToString(date, include-time)
Converts a date to a string that can be stored in the DatePicker, for
example:
var d = form.dateToString(new Date(), true);
form.setValues("hireDate", d);

I get the error:

Reason for request: An error 'TypeError: b.match is not a function' was
encountered while executing the script ' var d = form.dateToString(new
Date(), true); form.setValues("datumveld", d); '
Unrecoverable error during asynchronous call (b.match is not a
function)

Shown in Firefox.

Got no idea how the set a date in the datepickerfield in the HPD release
(it looks like a jquery datepicker ?)


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

Labels (1)
0 Likes
10 Replies
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


How is the data syntax in the datapicker (When you in HPD has a
datepicker and then picks a date) if you looks at it in the HTML?

I mean it might be a bug but it also could be that the HPD uses a never
library or a different toolset (jQuery or Dojo eg.)?
If you find the syntax and format then manipualte the data yourself.

I have never been able to have the builtin functionality working welel
and solid enough that I have moved away from manipulating with the data
myself.
I uses a free prototype extending library that adds iso8601 support to
the Date object. That way I always has full control over how my dateTime
objects behaves and returns data.
http://depressedpress.com/javascript-extensions/dp_dateextensions/

I know that it does not target your issue directly but hopefully it can
help you to work around the issue and in the future never needs to
struggle with dateTime tasks again.


--
Kerasit
------------------------------------------------------------------------
Kerasit's Profile: https://forums.netiq.com/member.php?userid=6043
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


Thanks,

I might need to look into that library but I really hoped it would be
possible to use the built in date picker.


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


This really needs a solution.

I have quote a lot of workflows that utilize dates, and while I can live
with not pre-filling the field it is essential to be able to write a
date attribute.

In this case I have a DateTimePcker where I select an expiration date
for a user.
Then We have a mapping activity to translate that date to eDir date
format and write that date.

How would that be written today with the new date format?

This is the current mapping code:
function setDateTime(){
/*
convert date from entry on wf to eDir format
*/

var edirFormat=new java.text.SimpleDateFormat("yyyyMMddhhmmssZ");
var workflowFormat=new
java.text.SimpleDateFormat("yyyyMMddhhmmssSSSZ");
try {
var
tempDate=workflowFormat.parse(flowdata.get('start/request_form/expirationdate'));
} catch (err) {
}
return edirFormat.format(tempDate);
};
setDateTime();


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


'Filed as bug 863530'
(https://bugzilla.novell.com/show_bug.cgi?id=863530) With Home and
Provisioning Dashboard the Date function changed


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates

On 02/12/2014 09:35 AM, joakim ganse wrote:
>
> 'Filed as bug 863530'
> (https://bugzilla.novell.com/show_bug.cgi?id=863530) With Home and
> Provisioning Dashboard the Date function changed
>
>

Greetings Joakim,
I have the bug and it will be investigated accordingly.

--

Sincerely,
Steven Williams
Lead Software Engineer
NetIQ
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates

On 02/12/2014 07:24 PM, Steven Williams wrote:
> On 02/12/2014 09:35 AM, joakim ganse wrote:
>>
>> 'Filed as bug 863530'
>> (https://bugzilla.novell.com/show_bug.cgi?id=863530) With Home and
>> Provisioning Dashboard the Date function changed
>>
>>

> Greetings Joakim,
> I have the bug and it will be investigated accordingly.
>

Greetings Joakim,
The bottom line is that form.dateToString will return a timestamp
that includes seconds. That is no longer going to supported with the
new control. The format must be M/d/yyyy h:mm tt

For the current release of HPD, you will need to stop using
form.dateToString. Instead, you will utilize something similar to

document.getElementById('%Field-Name').value = new
Date().toString('M/d/yyyy h:mm tt');


If you have 2 time fields (curDate and furDate)

The onload code for curDate:

document.getElementById('_curDate').value = new
Date().toString('M/d/yyyy h:mm
tt');


The onload code for furDate:

var s = new Date().getTime();
s = s + 3 * 1000 * 24 * 60 * 60;
document.getElementById('_furDate').value = new
Date(s).toString('M/d/yyyy
h:mm tt');

(The example code for furDate, will set the value to 3 days from the
current time)


When you run the above workflow you would see something similar to:


curDate: 2/13/2014 12:03 PM
furDate: 2/16/2014 12:03 PM


I will write a documentation bug to update the HPD documentation about
this and to note that dateToString can no longer be used.

--

Sincerely,
Steven Williams
Lead Software Engineer
NetIQ
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


Brilliant, thanks.


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


Thanks again for the example.

Can you clarify why your line works:
var s=new Date().getTime();
document.getElementById('_enabledate').value=new
Date(s).toString('M/d/yyyy h:mm tt');

But this doesn't:
var s=new Date().getTime();
form.setValues("enabledate", new Date(s).toString('M/d/yyyy h:mm tt'));

Actually what I'm asking is what does
"document.getElementById('_enabledate').value" mean?

Ok, so now I can get the dates and manipulate them in the form.

How do I then transform this new format to eDir format for writing it to
eDir?
In this case I want to write the loginActivationTime.

My old method was to add the loginActivationTime attribute to the entity
as a string value, not date.
Then in a form add the value to a field like the one you helped me
with.
In a mapping activity after, transform it to eDir format and lastly
write it to the attribute.

This is the function in my current Mapping activity that I need to
change:

function setDateTime(){
/*
convert date from entry on wf to eDir format
*/

var edirFormat=new java.text.SimpleDateFormat("yyyyMMddhhmmssZ");
var workflowFormat=new
java.text.SimpleDateFormat("yyyyMMddhhmmssSSSZ");
try {
var
tempDate=workflowFormat.parse(flowdata.get('start/request_form/enabledate'));
} catch (err) {
}
return edirFormat.format(tempDate);
};
setDateTime();


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates


Actually the mapping code works, not sure what I did wrong. Probably
changed too many things at the same time and missed one.


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=49936

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: HPD Dates

On 02/17/2014 05:54 AM, joakim ganse wrote:
>
> Actually the mapping code works, not sure what I did wrong. Probably
> changed too many things at the same time and missed one.
>
>

Greetings Joakim,
Glad to hear it.

--

Sincerely,
Steven Williams
Lead Software Engineer
NetIQ
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.