mirror of
https://github.com/Lissy93/dashy.git
synced 2025-09-23 17:58:35 +02:00
🔀 Merge pull request #875 from cauterize/feat/public_holidays_widget_state_parameter
✨ Adds state option for PublicHolidays widget
This commit is contained in:
commit
6fcb31f12a
@ -694,7 +694,8 @@ Counting down to the next day off work? This widget displays upcoming public hol
|
|||||||
|
|
||||||
**Field** | **Type** | **Required** | **Description**
|
**Field** | **Type** | **Required** | **Description**
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
**`country`** | `string` | Required | The region to fetch holiday data for, specified as a country code, e.g. `GB` or `US`
|
**`country`** | `string` | Required | The country to fetch holiday data for, specified as a country code, e.g. `GB` or `US`
|
||||||
|
**`state`** | `string` | **Optional** | restrict a country to a specific state defined by [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2), e.g. `LND`.
|
||||||
**`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`
|
**`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`
|
**`monthsToShow`** | `number` | **Optional** | The number of months in advance to show. Min: `1`, max: `24`. Defaults to `12`
|
||||||
|
|
||||||
@ -704,6 +705,7 @@ Counting down to the next day off work? This widget displays upcoming public hol
|
|||||||
- type: public-holidays
|
- type: public-holidays
|
||||||
options:
|
options:
|
||||||
country: GB
|
country: GB
|
||||||
|
region: LND
|
||||||
holidayType: all
|
holidayType: all
|
||||||
monthsToShow: 12
|
monthsToShow: 12
|
||||||
```
|
```
|
||||||
|
@ -54,10 +54,17 @@ export default {
|
|||||||
const then = new Date((now.setMonth(now.getMonth() + this.monthsToShow)));
|
const then = new Date((now.setMonth(now.getMonth() + this.monthsToShow)));
|
||||||
return `${then.getDate()}-${then.getMonth() + 1}-${then.getFullYear()}`;
|
return `${then.getDate()}-${then.getMonth() + 1}-${then.getFullYear()}`;
|
||||||
},
|
},
|
||||||
|
region() {
|
||||||
|
if (this.options?.state) {
|
||||||
|
return `®ion=${this.options.state}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
endpoint() {
|
endpoint() {
|
||||||
return `${widgetApiEndpoints.holidays}`
|
return `${widgetApiEndpoints.holidays}`
|
||||||
+ `&fromDate=${this.startDate}&toDate=${this.endDate}`
|
+ `&fromDate=${this.startDate}&toDate=${this.endDate}`
|
||||||
+ `&country=${this.country}&holidayType=${this.holidayType}`;
|
+ `&country=${this.country}&holidayType=${this.holidayType}`
|
||||||
|
+ `${this.region}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user