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 29, 2011, 2:32 PM
53 Posts

@Weekday problem

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 7
Can anyone confirm this, I assume it's a bug and will raise it with IBM, but I may be doing something stupid
 
I create a computed field on an xPage and set the value to be:

@Weekday(@Today)
 
This returns 0 (on the client and in the browser) for today, which is Tuesday (for those reading it on a different day:))

If I use a notesdatetime object and try:
 
var nDate=session.createDateTime("Today");
@Weekday(nDate.getDateOnly());
 
This returns 3 in the browser (correct), and 6 in the client (!)

My server's 8.5.2 FP1 and I've tried clients 8.5.2 FP1 and FP2
 
Cheers
Mar 29, 2011, 3:42 PM
9 Posts
Re: @Weekday problem
 Try @Weekday(@Today()) 
 
@Functions in SSJS require the brackets. 
Mar 29, 2011, 3:53 PM
53 Posts
Re: @Weekday problem
OK, so that works on both client and browser,  my fault there (thought it might be)
 
The SSJS still doesn't work - gives me 6 on the client for @Weekday(nDate.getDateOnly()), and 3 on the web. Can you try this and see if it's the same for you?

Cheers
Mar 29, 2011, 4:29 PM
53 Posts
NotesDateTime problem
OK, having more problems with a NotesDateTime object on the client in xpages
 
A field with:

var nDate:NotesDateTime = session.createDateTime("Today");
@Year(nDate.getDateOnly());

returns different values in the web and client - 2011 on the web, and 2013 on the client
 
My PC definitely has the correct time settings by the way.
 
Again, would be useful if anyone can confirm this
Mar 29, 2011, 4:55 PM
9 Posts
Re: NotesDateTime problem
Dan, what region are you working in? I'm in the UK and date/time fields display in UK format (DD/MM/YY) in the web client, but in US format (MM/DD/YY) in the Notes xpinc client 
Mar 29, 2011, 4:59 PM
9 Posts
Re: NotesDateTime problem
 Dan,
 
I tested your code and I get exactly the same result - 3 in the browser, 6 in the Note client. 
Mar 30, 2011, 9:15 AM
53 Posts
Re: NotesDateTime problem
Thanks, I'll submit a PMR. Have got round it by using a mix of javascript date objects and notesdatetime objects - I find notesdatetime objects easier to format into readable strings, but also needed the broken down values to be correct. So I've now got two different date objects to do what should be one thing
Mar 31, 2011, 9:36 AM
53 Posts
Re: NotesDateTime problem
According to IBM, @Year and other similar functions require a javascript date as the argument in xPages. The fact that it works in the web with notesdatetime.dateOnly is actually unexpected.
 
They didn't know of a way to get the year value from a NotesDateTime object in xPages, so gonna have to use a bit of a mixture I think

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