jackducasse / caleandar

A lightweight, library independent JavaScript calendar
MIT License
80 stars 41 forks source link

get Date #5

Open MusabAkram opened 7 years ago

MusabAkram commented 7 years ago

can you tell me how can i get the date which is clicked by user?

mauriciomartinez-itesm commented 5 years ago

More of a workaround, but you can get the date with this function:

(".cld-day").click(function(){
  var day = $(this).children(".cld-number").html();
  var month = $(".today").html().split(", ")[0];
  var year= $(".today").html().split(", ")[1];
  console.log(day+" "+month+" "+year)
})

It doesn't give it to you in a date format, but at least you can get the general date and convert it afterwards with another simple function...

I know this is an answer ages ago from when the question was asked, but maybe it can help another soul

PSanilP commented 9 months ago

There is a better way

  1. set the Link in the event data like so eventData: [ { 'Date': "2023-12-05", 'Title': 'Click 5th', 'Link': { id: 11, dt: "2023-12-05" } },

  2. in Settings EventClick: linkClicked, //(function) a function that should instantiate on the click of any event. parameters passed in via data link attribute.

  3. the function itself function linkClicked(A) { console.log(A.id); console.log(A.dt); }