Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

solutions/automations/vacation-calendar/ fails to import events that are created too far in advance

未关闭
#474 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@vinay-google 已经在做这个了。

开始于 2024年7月10日。

评估

这个 Issue 还没有评估数据。

描述

Summary

The code in solutions/automations/vacation-calendar/Code.js uses lastRun to constrain the event search, but only imports events that are timed between now and MONTHS_IN_ADVANCE months from now.
Hence, these events never get imported because when they satisfy the updatedMin parameter constraint in the Calendar.Events.list call, they fail the timeMin and timeMax constraint.

Expected Behavior

The code would import events, even events created a long time ago, if they occur within the search period (now, now+MONTHS_IN_ADVANCE).

Sample URL: https://github.com/googleworkspace/apps-script-samples/blob/main/solutions/automations/vacation-calendar/Code.js
Description:

Actual Behavior

The code only imports events if they were created within MONTHS_IN_ADVANCE of their occurrence. Other events are skipped entirely.

Steps to Reproduce the Problem

  1. Create a vacation event for a date 4 months from now.
  2. Let the script run.
  3. Notice that the event is not imported and is never imported.

Proposal

While the optSince parameter in findEvents is useful in further demonstrating the Calendar.Events.list API call, and generally reduces execution cost, it seems to prevent one important expected behavior for a team vacation populator---that events planned far in advance will show up in the team calendar. I suggest three alternatives:

  • Remove the updatedMin parameter in the findEvents body. That way, the code will still add upcoming events, but will add redundant events that get de-duplicated.
  • Set the default MONTHS_IN_ADVANCE relatively large, e.g., 12, 18 or more, so that the problem only manifests for events created much farther in advance.
  • Add a warning comment in the code that alerts the developer to the nature of these skipped imports and let the developer implement solution if desired.
主要语言
JavaScript
星标
5.2k
派生
2k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleworkspace/apps-script-samples 的其他 Issue

查看 googleworkspace/apps-script-samples 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。