SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Can't find method Time.IsCalendarDay

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Can't find method Time.IsCalendarDay
Author Message
kyofm



Joined: 30 Sep 2014
Posts: 21

Post Can't find method Time.IsCalendarDay Reply with quote
I am executing the following code:

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
Quote:
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
Quote:
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
The month value in Date is zero based. That's why you get June
Wed Apr 08, 2015 4:27 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
As for the error, please let me know the installed version of 24x7
Wed Apr 08, 2015 4:28 pm View user's profile Send private message
kyofm



Joined: 30 Sep 2014
Posts: 21

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
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 View user's profile Send private message
kyofm



Joined: 30 Sep 2014
Posts: 21

Post Reply with quote
The latest build 5.2.420 did not fix the problem. I still get
Quote:
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
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 View user's profile Send private message
kyofm



Joined: 30 Sep 2014
Posts: 21

Post Reply with quote
Could you provide a working example?

I tried
Code:
var result = Time.isCalendarDay(165, "2015-05-25");
Scheduler.logAddMessage("INFO", '@V"job_id"', '@V"job_name"', result);

and
Code:
var result = Time.isCalendarDay(165, "May 25, 2015");
Scheduler.logAddMessage("INFO", '@V"job_id"', '@V"job_name"', result);

Both of which resulted in
Quote:
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
No news yet, still waiting...
Tue Apr 21, 2015 10:15 am View user's profile Send private message
kyofm



Joined: 30 Sep 2014
Posts: 21

Post Reply with quote
I appreciate the update.
Fri May 01, 2015 8:39 am View user's profile Send private message
kyofm



Joined: 30 Sep 2014
Posts: 21

Post Reply with quote
Any news? It's been over a month.
Tue May 26, 2015 9:11 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
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
Code:
var memorial_day = new Date(2015, 4, 25);

Sat May 30, 2015 12:44 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.