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



Dec 19, 2013, 5:00 PM
3 Posts

Date issue - date missing from array

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: March 9 missing,date issue
  • Replies: 4

Hi All...

A weird one has cropped up with Domino dates.  I need an array containing every Sunday for the past two months, and the next four months.  So I wrote this Server Side code in a computed field:

___________________________________________

var tempdate1 = @Date(@Adjust(@Today(),0,-2,0,0,0,0)) //go back 2 months
var tempdate = @Adjust(tempdate1,0,0,-(@Weekday(tempdate1) - 1 ),0,0,0); //get nearest Sunday
var temp = new Array()
for (i=1;i<=180;i++) //go forward 6 months from day zero
{
 if (@Weekday(tempdate) == 1)  //if day is a Sunday, add to array
 {
  try
  {
   //temp.push(@Left(@Text(tempdate)," "));
   temp.push(@Text(@Month(tempdate)) + "/" + @Text(@Day(tempdate)) + "/" + @Right(@Text(tempdate.getFullYear()),2))
  }
  catch(e)
  {
  }
 }
 tempdate = @Adjust(tempdate,0,0,1,0,0,0)  //Go forward one day, and run again
}
@Unique(temp) //Make sure no duplicates exist

____________________________________________

 Here's the thing:  MARCH 9 2014 IS MISSING.  So I tried it again, minus the Sunday requirement.  Every date for the next four months.  And 3/9/14 is STILL missing -- the array skips from 3/8/14 to 3/10/14.  Is that some Mayan disaster date or something?  Or is it a bug?  If so, is it app-related or local to my server?

Much appreciated.

Dec 20, 2013, 1:25 PM
586 Posts
hmmm

Marc,

I don't know what's going on here.  My suggestion to you is to try and do this without using @Formulas.  Find a pure JavaScript solution.

I'm not suggesting that the @Formulas should not work, but I am suggesting that in the long run it will be so much better for you to try and avoid using them as much as possible.

I don't know how to do this on JavaScript myself.  But a quick Google let me to this question on StackOverFlow:

http://stackoverflow.com/questions/8516024/javascript-function-return-date-array-for-all-sundays-in-a-year

Which sounds like a pretty good start to what you're looking for.

Just my 2 cents.

 

Dave

Dec 20, 2013, 2:10 PM
54 Posts
Your code works for me on Client and on server. Both 8.5.3
Dec 20, 2013, 2:24 PM
3 Posts
Thanks -- must be something on our server

Thanks for the replies.  If it works elsewhere, must be something on our dev server or environment.

Dec 20, 2013, 2:24 PM
3 Posts
Thanks -- must be something on our server

Thanks for the replies.  If it works elsewhere, must be something on our dev server or environment.


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