Closed karanveerm closed 7 years ago
Nope. This is a bug. I spent a couple of hours on this since I am very new to JavaScript.
Do this under ics.js, and it will work fine:
//var start_seconds = ("00" + (start_date.getMinutes().toString())).slice(-2); //original
var start_seconds = ("00" + (start_date.getSeconds().toString())).slice(-2); //added by Syahmul
//var end_seconds = ("00" + (end_date.getMinutes().toString())).slice(-2); //original
var end_seconds = ("00" + (end_date.getSeconds().toString())).slice(-2); //added by Syahmul
To the one who is maintaining this repo, you may want to fix this bug as suggested here, and I hope it helps. :)
It's not just that he is using .getMinutes() instead of .getSeconds his test also forgets the hours. karanveerm is exactly right if you change the code it does work but I also have not tested it exhaustively. Cost me as much time as this library saved me.
I just created a pull request to fix this issue with solution suggested by @karanveerm.
@nwcell can you check? thanks
So it's been 2 years since last post, but following change worked for me 👍
// if (start_minutes + start_minutes + start_seconds + end_minutes + end_seconds != 0) {
if (start_hours +start_minutes + start_minutes + start_seconds + end_minutes + end_seconds != 0) {
start_time = 'T' + start_hours + start_minutes + start_seconds;
end_time = 'T' + end_hours + end_minutes + end_seconds;
}
Fixed
If the time is like 12:00 pm, i.e. minutes are not provided, then the time does not show up in the ics calendar. For example:
will be downloaded as an all day event.
I believe it will be fixed if we change: https://github.com/nwcell/ics.js/blob/master/ics.js#L77 to:
if (start_hours + start_minutes + start_seconds + end_hours + end_minutes + end_seconds != 0) {
(although I did not test this thoroughly)