Author |
Message |
kyofm
Joined: 30 Sep 2014 Posts: 21
|
|
Can't find method Time.IsCalendarDay |
|
I am executing the following code:
 |
 |
var memorial_day = new Date(2015, 5, 25);
Scheduler.logAddMessage("INFO", '@V"job_id"', '@V"job_name"', memorial_day);
var today = new Date();
var result = Time.isCalendarDay(165, today);
Scheduler.logAddMessage("INFO", '@V"job_id"', '@V"job_name"', result); |
The first block returns a log message of
 |
 |
Thu Jun 25 2015 00:00:00 GMT-400 (EDT) |
which is not correct since I created a Date object of May 25, 2015. What am I missing here?
The second block returns a log message of
 |
 |
An error occurred while executing automation script: Can’t find method Time.isCalendarDay(number, object). |
What am I doing wrong here?
Thanks
|
|
Wed Apr 08, 2015 12:52 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The month value in Date is zero based. That's why you get June
|
|
Wed Apr 08, 2015 4:27 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
As for the error, please let me know the installed version of 24x7
|
|
Wed Apr 08, 2015 4:28 pm |
|
 |
kyofm
Joined: 30 Sep 2014 Posts: 21
|
|
|
|
Yes I see the 0-based month note in the JavaScript docs now. Thanks.
I am running 24x7 Multi-Platform Edition Version 5.2 Build 417.
|
|
Thu Apr 09, 2015 8:36 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Please contact support and ask for the latest build 5.2.420. I believe it has a fix for for the issue with "IsCalendarDay" method.
|
|
Thu Apr 09, 2015 10:09 am |
|
 |
kyofm
Joined: 30 Sep 2014 Posts: 21
|
|
|
|
The latest build 5.2.420 did not fix the problem. I still get
 |
 |
An error occurred while executing automation script: Can’t find method Time.isCalendarDay(number, object). |
Time.getYear() works so it seems like it definitely is just a method issue rather than a class. Time.isHoliday() does not work either.
|
|
Mon Apr 13, 2015 10:37 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The second parameter in isCalendarDay seems to be of string type, while you're passing a Date object. Hope that helps.
|
|
Mon Apr 13, 2015 12:09 pm |
|
 |
kyofm
Joined: 30 Sep 2014 Posts: 21
|
|
|
|
Could you provide a working example?
I tried
 |
 |
var result = Time.isCalendarDay(165, "2015-05-25");
Scheduler.logAddMessage("INFO", '@V"job_id"', '@V"job_name"', result); |
and
 |
 |
var result = Time.isCalendarDay(165, "May 25, 2015");
Scheduler.logAddMessage("INFO", '@V"job_id"', '@V"job_name"', result); |
Both of which resulted in
 |
 |
An error occurred while executing automation script: Can’t find method Time.isCalendarDay(number, string). |
The "Paste JavaScript Syntax" says the day parameter is type Date.
|
|
Mon Apr 13, 2015 12:25 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I have reported this issue to the development team and asked to investigate. Still waiting for their response.
|
|
Thu Apr 16, 2015 10:23 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
No news yet, still waiting...
|
|
Tue Apr 21, 2015 10:15 am |
|
 |
kyofm
Joined: 30 Sep 2014 Posts: 21
|
|
|
|
I appreciate the update.
|
|
Fri May 01, 2015 8:39 am |
|
 |
kyofm
Joined: 30 Sep 2014 Posts: 21
|
|
|
|
Any news? It's been over a month.
|
|
Tue May 26, 2015 9:11 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
I'm sorry for not following up. This somehow slipped through the cracks. I was waiting for a fix which was released only yesterday. Please upgrade to the latest version 5.2.421.
By the way, in JavaScript month numbering is zero based. So for the memorial day you would need to use
 |
 |
var memorial_day = new Date(2015, 4, 25); |
|
|
Sat May 30, 2015 12:44 pm |
|
 |
|