Oct 5, 2015, 12: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, 5: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 5, 2015, 9:55 PM
110 Posts
Are you trying to do something like following?

Oct 6, 2015, 2: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, 7:09 AM
589 Posts

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, 9:58 AM
26 Posts
I would have said @explode
but that doesn't do date ranges in Xpages, so I found this


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())


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

Oct 6, 2015, 10:22 AM
51 Posts
Listing of days (Date range)

Thanks for all,

I got it from below link.



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() );
    return dateArray;