Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ISO8601 DateTime format #15

Open
martijn-gr opened this issue Aug 10, 2020 · 7 comments
Open

Support ISO8601 DateTime format #15

martijn-gr opened this issue Aug 10, 2020 · 7 comments

Comments

@martijn-gr
Copy link

Currently the Horizontal-Timeline 2.0 javascript module allows events to be added based upon Date or DateTime. However, these format are quite local depending. Not every country is utilizing a dd/mm/yyyy format. Some prefer dashes instead of slashes, others like to change the position of day and month numbers.

The ISO8601 Date and Time-format is documented with the Internation Standards Organisation (ISO) under number 8601 and was first published back in 1988.
This standard would allow us to write a Date and Time as yyyymmddTHHMMSS. And ofcourse several others as mentioned in the standard, please read on Wikipedia: https://en.wikipedia.org/wiki/ISO_8601.
This Date and Time format would allow us to more easily sort events based on time. as we can sort numerically instead of based on date/time property.

Also the use of ISO8601 would allow us to add events on the timeline without a before or after position value set, as the full event time clearly indicates where it should be placed. Only in the case of identical date and time this property would be useful.

I will add some suggestions on the implementation in the response below, to keep the feature request separated from the implementation discussion.

@martijn-gr
Copy link
Author

First of all, I am not an experienced JavaScript programmer, my expertise is in Networking but during my education and work carreer I learned the basics of about 15 different programming languages. So please forgive me if examples below are not exact JavaScript compatible.

Line 1339: addEvent: function (html, insertMethod, arrangementDate)

could become something
addEvent: function (parameter1, parameter2, parameter3)
Where we could check inside the function whether parameter1 does match the ISO8601 format; if it does, we could proceed with the new structure; if not continue testing;
If parameter1 is of the type of the Date-object, we could utilize this also (Date or ISO8601 would both be more standardized and interchangable than the current format)
If above checks did not pass; we assume old style, and can set the previous named parameters:
html = parameter1;
insertMethod = parameter2;
arrangementDate = parameter3;

Also, as you can see, i would suggest putting the Date/Time as the primary parameter for the function.
As the Date and Time are most likely the identifying component for the timeline. the content goes second, and a negotiable parameter could be third for where to insert, this could be left out to accept an default value which (imo) would be 'after'.

@stale
Copy link

stale bot commented Aug 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Aug 24, 2020
@martijn-gr
Copy link
Author

So the package maintainer is not interested in working on this case. I think this has to be forked and be improved somehow.

@stale stale bot removed the inactive label Aug 24, 2020
@yCodeTech
Copy link
Owner

I apologise for not replying sooner. I don't seem to get notified of new issues for some reason, I've only just noticed this today. I understand that this might be a good idea to introduce, especially for everyone outside of the UK (of which I reside). However, I too am only a novice at JavaScript, and I will be going to University this year to help rectify that.

At the moment, I don't have enough time to begin to try to implement this feature. However, if you have the time and are willing to research and implement this, then by all means do so on your forked project, and then you can submit a Pull Request to merge it with the plugin. I would appreciate any help.

I apologise again for the lateness of this response.

@martijn-gr
Copy link
Author

Well, i think this is already something nice and it just needs a bit improvement.
Nobody was perfect in what they do from day 1.

As you are open, i would love to discuss the potential changes and see the suggestions I have in mind will fit also your idea for the code. I will, try to create a quick first improvement which allows ISO8601 and Javascript DateTime objects.

@yCodeTech
Copy link
Owner

I'll look forward to reviewing your code and improving the plugin. 😊

@yCodeTech
Copy link
Owner

@martijn-gr I am still not sure how to implement this change. Please let me know if/when you have some code for me to review, to get me started on the implementation. Thanks. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants