node-calendar.js
function timegm(timegmt) {
      var year   = timegmt[0];
      var month  = timegmt[1];
      var day    = timegmt[2];
      var hour   = timegmt[3];
      var minute = timegmt[4];
      var second = timegmt[5];

      if(month < 1 || month > 12) {
        throw new IllegalMonthError();
      }

      if(day < 1 || day > (_DAYS_IN_MONTH[month] + (month === 2 && isleap(year)))) {
        throw new IllegalDayError();
      }

      if(hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59) {
        throw new IllegalTimeError();
      }

      var days = _toordinal(year, month, 1) - 719163 + day - 1;
      var hours = (days * 24) + hour;
      var minutes = (hours * 60) + minute;
      var seconds = (minutes * 60) + second;

      return seconds;
    }
function timegm(timegmt) {
      var year   = timegmt[0];
      var month  = timegmt[1];
      var day    = timegmt[2];
      var hour   = timegmt[3];
      var minute = timegmt[4];
      var second = timegmt[5];

      if(month < 1 || month > 12) {
        throw new IllegalMonthError();
      }

      if(day < 1 || day > (_DAYS_IN_MONTH[month] + (month === 2 && isleap(year)))) {
        throw new IllegalDayError();
      }

      if(hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59) {
        throw new IllegalTimeError();
      }

      var days = _toordinal(year, month, 1) - 719163 + day - 1;
      var hours = (days * 24) + hour;
      var minutes = (hours * 60) + minute;
      var seconds = (minutes * 60) + second;

      return seconds;
    }
function timegm ( timegmt ) { var year = timegmt [ 0 ] ; var month = timegmt [ 1 ] ; var day = timegmt [ 2 ] ; var hour = timegmt [ 3 ] ; var minute = timegmt [ 4 ] ; var second = timegmt [ 5 ] ; if ( month < 1 || month > 12 ) { throw new IllegalMonthError ( ) ; } if ( day < 1 || day > ( _DAYS_IN_MONTH [ month ] + ( month === 2 && isleap ( year ) ) ) ) { throw new IllegalDayError ( ) ; } if ( hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59 ) { throw new IllegalTimeError ( ) ; } var days = _toordinal ( year , month , 1 ) - 719163 + day - 1 ; var hours = ( days * 24 ) + hour ; var minutes = ( hours * 60 ) + minute ; var seconds = ( minutes * 60 ) + second ; return seconds ; }
Unrelated but handy function to calculate Unix timestamp from GMT.

@param {Array} tuple
@throws {IllegalMonthError} If the provided month element is invalid.
@throws {IllegalDayError} If the provided day element is invalid.
@api public
Unrelated but handy function to calculate Unix timestamp from GMT .