lib/index.js
function newYearsSpecial(year) {

  // 1. hold onto the date, we'll need it in #3
  var date = holidays.newYearsDay(year)

  // 2. do the usual.
  var newYears = makeHoliday(
    date,
    { name: 'New Year\'s Day', bank: !date.observed },
    { name: 'New Year\'s Day (Observed)', bank: true }
  )

  // 3. check if the observed date is in the previous year...
  if (date.observed && date.observed.getFullYear() < year) {
    // specify that year in the observed holiday's date.
    newYears[1].date.year = year - 1
  }

  return newYears
}
function newYearsSpecial(year) {

  // 1. hold onto the date, we'll need it in #3
  var date = holidays.newYearsDay(year)

  // 2. do the usual.
  var newYears = makeHoliday(
    date,
    { name: 'New Year\'s Day', bank: !date.observed },
    { name: 'New Year\'s Day (Observed)', bank: true }
  )

  // 3. check if the observed date is in the previous year...
  if (date.observed && date.observed.getFullYear() < year) {
    // specify that year in the observed holiday's date.
    newYears[1].date.year = year - 1
  }

  return newYears
}
function newYearsSpecial ( year ) { // 1. hold onto the date, we'll need it in #3 var date = holidays . newYearsDay ( year ) // 2. do the usual. var newYears = makeHoliday ( date , { name : 'New Year\'s Day' , bank : ! date . observed } , { name : 'New Year\'s Day (Observed)' , bank : true } ) // 3. check if the observed date is in the previous year... if ( date . observed && date . observed . getFullYear ( ) < year ) { // specify that year in the observed holiday's date. newYears [ 1 ] . date . year = year - 1 } return newYears }
The New Year's holiday can have an observed date in the previous year. That messes with the whole "generate and cache holidays by year" thing. This handles it by identifying when that happens and specifying the custom year. The @date/holidays package handles the custom year as of v0.3.1.
The New Year s holiday can have an observed date in the previous year . That messes with the whole generate and cache holidays by year thing . This handles it by identifying when that happens and specifying the custom year . The