【问题标题】:Angular UI Calendar Integrate with public Holidays ,Is there any Public Holidays API?Angular UI 日历与公共假期集成,是否有任何公共假期 API?
【发布时间】:2020-08-12 22:00:02
【问题描述】:

我正在使用 Angular UI 日历,使用此链接 [http://angular-ui.github.io/ui-calendar/]

现在我们想将日历与公共假期集成,假设让我们在印度,然后显示印度公共假期, 所以我只想知道有没有这样的 API 可以为我提供公共假期的 JSON 数据

【问题讨论】:

  • 谷歌日历通知公众假期。谷歌日历有一个开放的 API。
  • 给我一个链接

标签: angularjs calendar google-api


【解决方案1】:

您可以使用的另一个解决方案是 Nager.Date 大多数欧洲国家、美国和加拿大都受支持。这是一个开源项目。

其他国家可以通过github项目提交。

示例(JSON - API)

请求

http://date.nager.at/api/v1/get/{countrycode}/{year}

结果

[  
    {  
        "date":"2017-01-01",
        "localName":"New Year's Day",
        "name":"New Year's Day",
        "countryCode":"US",
        "fixed":true,
        "countyOfficialHoliday":true,
        "countyAdministrationHoliday":true,
        "global":true,
        "counties":null,
        "launchYear":null
    },
    {  
        "date":"2017-01-16",
        "localName":"Martin Luther King, Jr. Day",
        "name":"Martin Luther King, Jr. Day",
        "countryCode":"US",
        "fixed":true,
        "countyOfficialHoliday":true,
        "countyAdministrationHoliday":true,
        "global":true,
        "counties":null,
        "launchYear":null
    }
]

链接

【讨论】:

  • 是否有任何 API 可以提供印度假期。这个不适用于印度国家代码。
【解决方案2】:

我们找到了解决方案,Google 日历提供了 JSON 数据,您只需提供正确的国家/地区代码 $scope.currentCountry= "是国家代码 "ex {'India':'indian','Denmark':'danish'} $scope.start = 您想要假期数据的日期 $scope.end = 结束日期

http://www.google.com/calendar/feeds/'+$scope.currentCountry+'__en%40holiday.calendar.google.com/public/basic?alt=json&start-min='+$scope.start+'&start-max='+$scope.end

【讨论】:

    猜你喜欢
    • 2016-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-30
    • 1970-01-01
    • 2022-01-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多