diff --git a/docs/widgets.md b/docs/widgets.md
index c444c16e..04259561 100644
--- a/docs/widgets.md
+++ b/docs/widgets.md
@@ -12,12 +12,14 @@ Dashy has support for displaying dynamic content in the form of widgets. There a
- [RSS Feed](#rss-feed)
- [XKCD Comics](#xkcd-comics)
- [Code Stats](#code-stats)
+ - [Public Holidays](#public-holidays)
- [TFL Status](#tfl-status)
- [Exchange Rates](#exchange-rates)
- [Stock Price History](#stock-price-history)
- [Joke of the Day](#joke)
- [Flight Data](#flight-data)
- [Self-Hosted Services Widgets](#dynamic-widgets)
+ - [System Info](#system-info)
- [CPU History](#cpu-history-netdata)
- [Memory History](#memory-history-netdata)
- [System Load History](#load-history-netdata)
@@ -258,6 +260,32 @@ Display your coding summary. [Code::Stats](https://codestats.net/) is a free and
---
+### Public Holidays
+
+Counting down to the next day off work? This widget displays upcoming public holidays for your country. Data is fetched from [Enrico](http://kayaposoft.com/enrico/)
+
+

+
+##### Options
+
+**Field** | **Type** | **Required** | **Description**
+--- | --- | --- | ---
+**`country`** | `string` | Required | The region to fetch holiday data for, specified as a country code, e.g. `GB` or `US`
+**`holidayType`** | `string` | __Optional__ | The type of holidays to fetch. Can be: `all`, `public_holiday`, `observance`, `school_holiday`, `other_day` or `extra_working_day`. Defaults to `public_holiday`
+**`monthsToShow`** | `number` | __Optional__ | The number of months in advance to show. Min: `1`, max: `24`. Defaults to `12`
+
+##### Example
+
+```yaml
+- type: public-holidays
+ options:
+ country: GB
+ holidayType: all
+ monthsToShow: 12
+```
+
+---
+
### TFL Status
Shows real-time tube status of the London Underground. All options are optional.
@@ -404,6 +432,25 @@ Displays airport departure and arrival flights, using data from [AeroDataBox](ht
## Self-Hosted Services Widgets
+
+### System Info
+
+Displays info about the server which Dashy is hosted on. Includes user + host, operating system, uptime and basic memory & load data.
+
+
+
+##### Options
+
+No config options.
+
+##### Example
+
+```yaml
+- type: system-info
+```
+
+---
+
### CPU History (NetData)
Pull recent CPU usage history from NetData.
@@ -474,24 +521,6 @@ Pull recent load usage in 1, 5 and 15 minute intervals, from NetData.
---
-### System Info
-
-Displays info about the server which Dashy is hosted on. Includes user + host, operating system, uptime and basic memory & load data.
-
-
-
-##### Options
-
-No config options.
-
-##### Example
-
-```yaml
-- type: system-info
-```
-
----
-
## Dynamic Widgets
### Iframe Widget
diff --git a/src/components/Widgets/PublicHolidays.vue b/src/components/Widgets/PublicHolidays.vue
new file mode 100644
index 00000000..dc0153f5
--- /dev/null
+++ b/src/components/Widgets/PublicHolidays.vue
@@ -0,0 +1,121 @@
+
+
+
+
{{ holiday.date }}
+
{{ holiday.name }}
+
+
+
+
+
+
+
diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue
index 416a3220..ec1e839b 100644
--- a/src/components/Widgets/WidgetBase.vue
+++ b/src/components/Widgets/WidgetBase.vue
@@ -102,6 +102,13 @@
@error="handleError"
:ref="widgetRef"
/>
+
{
export const convertTimestampToDate = (timestamp) => {
const localFormat = navigator.language;
const dateFormat = {
- weekday: 'short', day: 'numeric', month: 'short', year: 'numeric',
+ weekday: 'short', day: 'numeric', month: 'short', year: '2-digit',
};
const date = new Date(timestamp).toLocaleDateString(localFormat, dateFormat);
return `${date}`;
@@ -91,3 +92,7 @@ export const showNumAsThousand = (bigNum) => {
if (bigNum < 1000) return bigNum;
return `${Math.round(bigNum / 1000)}k`;
};
+
+export const capitalize = (str) => {
+ return str.replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase())));
+};
diff --git a/src/utils/defaults.js b/src/utils/defaults.js
index 19da9cbd..d5bcdd06 100644
--- a/src/utils/defaults.js
+++ b/src/utils/defaults.js
@@ -218,6 +218,7 @@ module.exports = {
flights: 'https://aerodatabox.p.rapidapi.com/flights/airports/icao/',
rssToJson: 'https://api.rss2json.com/v1/api.json',
codeStats: 'https://codestats.net/',
+ holidays: 'https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange',
},
/* URLs for web search engines */
searchEngineUrls: {