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



Oct 5, 2015, 4:37 PM
51 Posts
topic has been resolvedResolved

Listing of days (Date range)

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Administrator,Developer
  • Tags: Date range,dates
  • Replies: 6

Hi All,

first of all I am Sorry to disturb you guys.

I have one leave request application, where i am saving my leaves selecting from date and to date using date picker control.
my query is i want to list my leave days including from date to till to date in a computed field.


Am feeling some difficulties to compare using date.

How can I make these ?

Thanks in advance.

 

Oct 5, 2015, 9:57 PM
453 Posts
Do you have any sample code?

Dates can be a really big pain.  Are you using javascript or java? 

Post your code to this point 

Oct 6, 2015, 6:24 AM
51 Posts
Listing of days

Many thanks for the prompt reply.

I am trying to implement using SSJS. 

Baxter Jimuk, You are completely right what i am planning to do.

 

Oct 6, 2015, 11:09 AM
586 Posts
hmm

Typically what i do is figure out the formula I need first in the Notes Client.  Just search the view in the database.  That's pretty much the same formula you'll use with the domino object model in SSJS.  You would just need to turn it into a proper string and pass into a search method.

Suggest you get the formula first - get it working then tackle the SSJS.

Oct 6, 2015, 1:58 PM
26 Posts
I would have said @explode
but that doesn't do date ranges in Xpages, so I found this

http://www.notesninjas.com/A555F9/nn.nsf/b2b6ed1db864a76080256ada006da907/a17c83e1e12d29878025786c0054788f!OpenDocument

var Start_Date = getComponent("Start_Date").getValue();
var End_Date = getComponent("End_Date").getValue();

// Only update if End Date is not nothing, assume Start_Date is set to today
if (@Text(End_Date)!="")
{
 
dDatebetween=new Date(Start_Date.getTime());
var dts="";

while (dDatebetween.getTime() <= End_Date.getTime())
 {

   dts=dts+(@Right("0"+@Text(@Day(dDatebetween)),2)+"/"+@Right("0"+@Text(@Month(dDatebetween)),2)+"/"+@Right(@Text(@Year(dDatebetween)),2))+",";

   dDatebetween=new Date(dDatebetween.getTime()+86400000)
 }

getComponent("HolDates").setValue(@Left(dts,@Length(dts)-1));
Oct 6, 2015, 2:22 PM
51 Posts
Listing of days (Date range)

Thanks for all,

I got it from below link.

http://stackoverflow.com/questions/16352792/check-date-range-vs-some-other-date-ranges-for-missing-days

 

var dateArray = new Array();

//Get the date
var AbsenctSince:NotesDateTime = session.createDateTime(document1.getItemValue("from").toString().substr(0,19));
var endDate:NotesDateTime = session.createDateTime(document1.getItemValue("to").toString().substr(0,19));

//Get all days between two dates
dateArray = getDates(AbsenctSince, endDate);

 

 

and then add below function code,

 

function getDates(startDate:NotesDateTime, endDate:NotesDateTime)
{
    var dateArray = new Array();
    var currentDate:NotesDateTime = startDate;
    while (endDate.timeDifference(currentDate) > -1)
    {
        dateArray.push( currentDate.getDateOnly() );
        currentDate.adjustDay(1);
    }
    return dateArray;
}


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