Difference between revisions of "Template:Dow holiday"
From Geohashing
imported>Tjtrumpet2323 (GAAH!!!! I left a test {{#vardefine:date|2010-04-02}} in this template?!??!?! WHY?!!) |
(→Notes: be explicit that one-off closures are not handled by this template) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly>{{#vardefine: | + | <includeonly>{{#vardefine:qdate|{{{1|{{CURRENTTIMESTAMP}}}}}}}{{#ifexpr: {{#time:N|{{#var:qdate}}}} <= 5 | {{#vardefine:weekday|1}} | {{#vardefine:weekday|0}} }}{{#switch: {{#time:m|{{#var:qdate}}}} |
− | | 1 = {{#ifexpr: ({{#time:j|{{#var: | + | | 1 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = 1 and {{#var:weekday}} = 1) or ({{#time:j|{{#var:qdate}}}} = 2 and {{#time:N|{{#var:qdate}}}} = 1) or ({{#time:j|{{#var:qdate}}}} = {{weekday in month|{{#time:Y|{{#var:qdate}}}}|1|1|3}}) | 1 | 0}} |
− | | 2 = {{#ifexpr: ({{#time:j|{{#var: | + | | 2 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = {{weekday in month|{{#time:Y|{{#var:qdate}}}}|2|1|3}}) | 1 | 0}} |
− | | 3 = {{#ifexpr: ({{#time:Ymd|{{#var: | + | | 3 = {{#ifexpr: ({{#time:Ymd|{{#var:qdate}}}} = {{#time:Ymd|{{Easter|{{#time:Y|{{#var:qdate}}}}}} -2 days}}) | 1 | 0}} |
− | | 4 = {{#ifexpr: ({{#time:Ymd|{{#var: | + | | 4 = {{#ifexpr: ({{#time:Ymd|{{#var:qdate}}}} = {{#time:Ymd|{{Easter|{{#time:Y|{{#var:qdate}}}}}} -2 days}}) | 1 | 0}} |
− | | 5 = {{#ifexpr: ({{#time:j|{{#var: | + | | 5 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = {{weekday in month|{{#time:Y|{{#var:qdate}}}}|5|1|-1}}) | 1 | 0}} |
− | | 6 = 0 | + | | 6 = {{#ifexpr: ({{#time:Y|{{#var:qdate}}}} >= 2022) | {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = 18 and {{#time:N|{{#var:qdate}}}} = 5) or ({{#time:j|{{#var:qdate}}}} = 19 and {{#var:weekday}} = 1) or ({{#time:j|{{#var:qdate}}}} = 20 and {{#time:N|{{#var:qdate}}}} = 1) | 1 | 0}} | 0}} |
− | | 7 = {{#ifexpr: ({{#time:j|{{#var: | + | | 7 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = 3 and {{#time:N|{{#var:qdate}}}} = 5) or ({{#time:j|{{#var:qdate}}}} = 4 and {{#var:weekday}} = 1) or ({{#time:j|{{#var:qdate}}}} = 5 and {{#time:N|{{#var:qdate}}}} = 1) | 1 | 0}} |
| 8 = 0 | | 8 = 0 | ||
− | | 9 = {{#ifexpr: ({{#time:j|{{#var: | + | | 9 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = {{weekday in month|{{#time:Y|{{#var:qdate}}}}|9|1|1}}) | 1 | 0}} |
| 10 = 0 | | 10 = 0 | ||
− | | 11 = {{#ifexpr: ({{#time:j|{{#var: | + | | 11 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = {{weekday in month|{{#time:Y|{{#var:qdate}}}}|11|4|4}}) | 1 | 0}} |
− | | 12 = {{#ifexpr: ({{#time:j|{{#var: | + | | 12 = {{#ifexpr: ({{#time:j|{{#var:qdate}}}} = 24 and {{#time:N|{{#var:qdate}}}} = 5) or ({{#time:j|{{#var:qdate}}}} = 25 and {{#var:weekday}} = 1) or ({{#time:j|{{#var:qdate}}}} = 26 and {{#time:N|{{#var:qdate}}}} = 1) or ({{#time:j|{{#var:qdate}}}} = 31 and {{#time:N|{{#var:qdate}}}} = 5) | 1 | 0}} |
| #default = 0 | | #default = 0 | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
Line 20: | Line 20: | ||
** Weekends return 0 and are not treated as holidays, as they can be programmatically handled by other templates. | ** Weekends return 0 and are not treated as holidays, as they can be programmatically handled by other templates. | ||
** All holidays are systematically and calculationally determined. | ** All holidays are systematically and calculationally determined. | ||
+ | |||
+ | === Notes === | ||
+ | * '''This template is only explicitly valid for regularly-scheduled closures from 2008 through the reasonably expected future.''' | ||
+ | ** For example, this template incorporates [https://en.wikipedia.org/wiki/Juneteenth Juneteenth National Independence Day] with effect from June 2022. | ||
+ | ** However, '''it does ''not'' incorporate one-off closures''' such as those observed: | ||
+ | *** 11–14 September 2001, following terror attacks in the US | ||
+ | *** 29–30 October 2012, in response to Hurricane Sandy | ||
+ | *** 5 December 2018, in observance of President George HW Bush's state funeral | ||
+ | * While NYSE holidays were generally stable for some time before the creation of Geohashing in 2008, this template applies all holidays observed at that time proleptically into the indefinite past. It does not contemplate, for example, when precisely among its various stages of recognition and adoption the NYSE began observing [https://en.wikipedia.org/wiki/Martin_Luther_King_Jr._Day Martin Luther King, Jr. Day]. | ||
== See also == | == See also == | ||
− | [ | + | [https://www.nyse.com/markets/hours-calendars NYSE Calendar] |
</noinclude> | </noinclude> |
Latest revision as of 05:53, 5 August 2024
Usage
{{Dow holiday|2008-11-27}}
- Date must be passed in YYYY-MM-DD format.
- Returns 1 if the date passed is a Dow holiday; 0 otherwise.
- Weekends return 0 and are not treated as holidays, as they can be programmatically handled by other templates.
- All holidays are systematically and calculationally determined.
Notes
- This template is only explicitly valid for regularly-scheduled closures from 2008 through the reasonably expected future.
- For example, this template incorporates Juneteenth National Independence Day with effect from June 2022.
- However, it does not incorporate one-off closures such as those observed:
- 11–14 September 2001, following terror attacks in the US
- 29–30 October 2012, in response to Hurricane Sandy
- 5 December 2018, in observance of President George HW Bush's state funeral
- While NYSE holidays were generally stable for some time before the creation of Geohashing in 2008, this template applies all holidays observed at that time proleptically into the indefinite past. It does not contemplate, for example, when precisely among its various stages of recognition and adoption the NYSE began observing Martin Luther King, Jr. Day.