Menu
Welcome, Guest
Username: Password: Secret Key Remember me
Welcome to the Developer forum!
Get all your questions answered here. Learn to integrate calendar in your application.
  • Page:
  • 1

TOPIC: Newbie - Need help with loading events

Newbie - Need help with loading events 13 years 11 months ago #260

  • swetha
  • swetha's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Hi,

I am using web2cal in my portal. I was going through the health club demo file given in the web2cal folder to understand how the events are loaded. From what I see the data passed like this

events.push(createHealthClubEvent("Yoga Training", 1, "yoga aud", "John Smith", createDateTime(23, 0,-1), createDateTime(23, 30,1), "Yoga is good for health", true,
"PENDING", 20, "PT", "2", [], [] ));


Most of the relevant data is passed to createHealthClubEven but I don't see date being passed anywhere. So my question is if I have to load an event into the calendar for a particular date how do I do it?

Also, can someone please explain createDateTime function?

I see that the last argument is number of days, but i shows some negative values being passed.


Any help would be highly appreciated.

Thanks,
Swetha

Attachment healthclubdemo.zip not found

Please Log in to join the conversation.

Last edit: by swetha.

Re:Newbie - Need help with loading events 13 years 11 months ago #261

  • ragskarnam
  • ragskarnam's Avatar
  • Visitor
  • Visitor
Hey, you can see the createDateTime function in the sampleData.js

It is a simple utility function.

For your convenience I have pasted the function here
function createDateTime(ti, h, numofDays)
{
    var dd = new Date();
    dd.setHours(ti);
    dd.setMinutes(h);
    
    var x = new UTC(dd.getTime());
    
    if (numofDays) 
    {
        x = new UTC(dd.addDays(numofDays));
    } 
    return x;
}


Hope this helps....

Please Log in to join the conversation.

Re:Newbie - Need help with loading events 13 years 11 months ago #263

  • swetha
  • swetha's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Thanks for your quick reply :) . But my actual question was
If I have to load an event that is for a particular date and which is not current date, How do I do it?
For Example: Today is April 24th 2010. When I load an event as done in the sample files, it always shows up on today's date. Suppose I want to load an event that is on say April 30th 2010. How do I do it?

Please Log in to join the conversation.

Re:Newbie - Need help with loading events 13 years 11 months ago #265

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 143
  • Karma: 1
  • Thank you received: 1
You basically néed to provide date and time.

Try new Date(2010, 3,30,2,30).

This represents April 30,2010 2:30 AM

see www.w3schools.com/jsref/jsref_obj_date.asp for more info

Please Log in to join the conversation.


Team Web2Cal.

Re:Newbie - Need help with loading events 13 years 11 months ago #266

  • swetha
  • swetha's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Thanks a lot :) It worked. I really appreciate your quick replies for all my questions.

Swetha.

Please Log in to join the conversation.

  • Page:
  • 1
Time to create page: 4.034 seconds
Powered by Kunena Forum

LATEST IN FORUM

  • No posts to display.

ABOUT US