This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 19, 2012, 12:39 PM
53 Posts
topic has been resolvedResolved

Date value on a form when editing

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 1
I'm trying to use the value of a date field on a current form to change the available values in a combo box on the same form
 
The combo box has SSJS to look up it's values and then check against the date entered in a field
 
The field is a standard date field using the date/time picker.
 
The code always returns the date incorrectly as January 1 1970. I've tried getComponentValue, and using the document data source itself, neither work
 
var dd = new Date(getComponent("DateField").getValue());
 or
var dd = new Date(document1.getItemValueDate("DateField"));
 
getComponent("DateField").getValue() returns the correct date (albeit in US format, which might be the problem), I can check this by printing this value
 
Anyone got any idea how to get this working? I'd have thought it was simple, and I might be doing something obviously wrong but I've googled this and not found anything relevant
 
Cheers
 
 
Mar 19, 2012, 1:49 PM
53 Posts
Re: Date value on a form when editing
OK, ignore this, worked it out almost immediately after I posted (having been trying for half a day)
 
Need to get the NotesDateTime value first, so:
 
var ddt:NotesDateTime = session.createDateTime(getComponent("DateField").getValue());
var dd = new Date(ddt.toJavaDate())
 
I need a js date as I then need to get the day and month values (which I don't think you can do in SSJS from a notesdatetime)

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal