ka215 / jquery.timeline

You can easily create the horizontal timeline with two types by using this jQuery plugin.
MIT License
240 stars 43 forks source link

Click on space on timeline to add new event #52

Open robibuckley opened 4 years ago

robibuckley commented 4 years ago

Hi,

I want to use the timeline in order to manage a calendar of events. What I would like to do is to be able to click on the empty space on the timeline to add a new event (via a pop up)

Is there any way of hooking up a click (or select/drag) event on the empty timeline which would give the date(s) selected in order to create a new event?

ka215 commented 3 years ago

I have a way to do that. I will show you how to do it as a demonstration in the near future. Please wait.

ka215 commented 3 years ago

Hi there,

I have been released the demo page below.

CRUD System for jQuery.Timeline

Please try to see so.

robibuckley commented 3 years ago

Hi - that example seems to be broken. Did you ever come up with a solution for this? i.e. click on an empty area of the timeline to add a new event

ka215 commented 3 years ago

No, that example is working fine. Firstly select "Create Event" from the Change Mode pull-down in the upper left corner, then "double-click" anywhere you want on the timeline. A dialog will open for adding a new event.

robibuckley commented 3 years ago

Aaah yes - all sorted now. Although I think I have spotted a bug. If you set the timezone to another timezone (such as Asia/Makassar) the present time marker doesn't update? Because the _nowDt var within the _viewPresentTime() method is being set as new Date() with no timeZone passed in. Does it not need a toLocaleString adding to set the timeZone?

ka215 commented 3 years ago

JavaScript's Date object handles local time depending on the host machine's time zone, unless you explicitly use a UTC-related method. In other words, the date and time normally retrieved from a Date object instantiated with new Date() will be in local time. jQuery.Timeline does not have time zone information in the instantiated component itself. Therefore, the vertical line indicator for the current point in time in the timeline container will show the current time in local time, which depends on the time zone of the host machine. I made some changes to the time zone of the host machine to check the display.

The time zone offset for Asia/Makassar is UTC+8:00, which is the same as Singapore. Therefore, on a Windows PC, you can change the time zone to Singapore Standard Time to see if it works. Later, I changed to the time zone Tokyo or Samoa and displayed the same timeline, and the indicator at the current time was displayed normally according to each time zone.

As per the plugin specifications, it works without any problems.

Thank you,