Import Calendar action problem?

Hi there,

I’ve installed the Import Calendar action however it is not working how I expect.

It seems that I have to specify the end date as the day after the range that I want.

For example, say I want to import the week just gone, Monday 3rd May to Friday 7th May. If I specify these dates in the action, Friday’s events are not imported. The action only imports May 3 to May 6. If I want to include the 7th, then I must set the end date in the action to the 8th. Which is a bit counter-intuitive.

Is this how it’s meant to work?

The calendar retrieval is based on events() which doesn’t describe the precise behaviour, but if they are boundaries, I guess this would make sense for your use.

Let’s say you use a date of 2021-05-09 as your end date. That is actually only part of the date object as it the full version also includes a time component. When not specified, the time component will default to the start of the day, and that’s where I think your issue comes from.

For the start date, this works well as when using it as a boundary, you would typically want to measure from the start of a date. However for the end date, it is also measuring from the start of that date, whereas typically you would want to measure to the end of that date.

Given that there are 86.4M milliiseconds in a day and JavaScript dates use milliseonds for offset calculations, I think adding 86,399,999 to the end date variable (end) before it is used, should resolve the issue.

Hope that helps.

Thank you. That makes sense.

Unfortunately I don’t know how to write or amend code so I might have to just always use the day after when I run this action.

Here you go.

1 Like

Thanks! That is awesome and very kind of you to have done that. It works perfectly.