New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@18f/us-federal-holidays

Package Overview
Dependencies
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@18f/us-federal-holidays - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

package.json
{
"name": "@18f/us-federal-holidays",
"version": "1.2.0",
"version": "1.2.1",
"description": "All about US federal holidays",

@@ -5,0 +5,0 @@ "main": "bin/index.js",

@@ -18,35 +18,37 @@ # US Federal Holidays

```javascript
var fedHolidays = require('us-federal-holidays');
var holidays = fedHolidays.allForYear(2016);
const fedHolidays = require('@18f/us-federal-holidays');
const options = { shiftSaturdayHolidays: true, shiftSundayHolidays: true };
const holidays = fedHolidays.allForYear(2016, options);
// Returns
[ { name: 'New Year\'s Day',
date: Thu Dec 31 2015 18:00:00 GMT-0600 (CST),
date: 2016-01-01T00:00:00.000Z,
dateString: '2016-1-1' },
{ name: 'Birthday of Martin Luther King, Jr.',
date: Sun Jan 17 2016 18:00:00 GMT-0600 (CST),
date: 2016-01-18T00:00:00.000Z,
dateString: '2016-1-18' },
{ name: 'Washington\'s Birthday',
date: Sun Feb 14 2016 18:00:00 GMT-0600 (CST),
date: 2016-02-15T00:00:00.000Z,
dateString: '2016-2-15' },
{ name: 'Memorial Day',
date: Sun May 29 2016 19:00:00 GMT-0500 (CDT),
date: 2016-05-30T00:00:00.000Z,
dateString: '2016-5-30' },
{ name: 'Independence Day',
date: Sun Jul 03 2016 19:00:00 GMT-0500 (CDT),
date: 2016-07-04T00:00:00.000Z,
dateString: '2016-7-4' },
{ name: 'Labor Day',
date: Sun Sep 04 2016 19:00:00 GMT-0500 (CDT),
date: 2016-09-05T00:00:00.000Z,
dateString: '2016-9-5' },
{ name: 'Columbus Day',
date: Sun Oct 09 2016 19:00:00 GMT-0500 (CDT),
date: 2016-10-10T00:00:00.000Z,
dateString: '2016-10-10' },
{ name: 'Veterans Day',
date: Thu Nov 10 2016 18:00:00 GMT-0600 (CST),
date: 2016-11-11T00:00:00.000Z,
dateString: '2016-11-11' },
{ name: 'Thanksgiving Day',
date: Wed Nov 23 2016 18:00:00 GMT-0600 (CST),
date: 2016-11-24T00:00:00.000Z,
dateString: '2016-11-24' },
{ name: 'Christmas Day',
date: Sun Dec 25 2016 18:00:00 GMT-0600 (CST),
date: 2016-12-26T00:00:00.000Z,
dateString: '2016-12-26' } ]

@@ -58,8 +60,10 @@ ```

```javascript
var fedHolidays = require('us-federal-holidays');
var isAHoliday = fedHolidays.isAHoliday(myDate, opts);
const fedHolidays = require('@18f/us-federal-holidays');
const options = { shiftSaturdayHolidays: true, shiftSundayHolidays: true, utc: false };
const isAHoliday = fedHolidays.isAHoliday(myDate, options);
// Returns true or false
```
The options is a plain object:
Both methods take `options` as a second argument. This argument is a plain object which accepts the following properties:

@@ -72,2 +76,3 @@ ```javascript

// holidays on weekends, you can adjust!
// Default value is true.
shiftSaturdayHolidays: boolean,

@@ -79,2 +84,3 @@

// holidays on weekends, you can adjust!
// Default value is true.
shiftSundayHolidays: boolean,

@@ -86,2 +92,4 @@

// creating objects from UTC-based dates.
// Default value is false.
// This option only applies to the isAHoliday method.
utc: boolean

@@ -88,0 +96,0 @@ }

@@ -106,4 +106,4 @@ function getNthDayOf(n, day, month, year) {

if (dow == 0 && shiftSundayHolidays) {
// Actual holiday falls on Sunday. Shift
// the observed date forward to Monday.
// Actual holiday falls on Sunday.
// Shift the observed date forward to Monday.
holiday.date = new Date(

@@ -117,4 +117,4 @@ Date.UTC(

} else if (dow == 6 && shiftSaturdayHolidays) {
// Actual holiday falls on Saturday. Shift
// the observed date backward to Friday.
// Actual holiday falls on Saturday.
// Shift the observed date backward to Friday.
holiday.date = new Date(

@@ -121,0 +121,0 @@ Date.UTC(

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc