build/ical.js
function parseDurationChunk(letter, number, object) {
    var type;
    switch (letter) {
      case 'P':
        if (number && number === '-') {
          object.isNegative = true;
        } else {
          object.isNegative = false;
        }
        // period
        break;
      case 'D':
        type = 'days';
        break;
      case 'W':
        type = 'weeks';
        break;
      case 'H':
        type = 'hours';
        break;
      case 'M':
        type = 'minutes';
        break;
      case 'S':
        type = 'seconds';
        break;
      default:
        // Not a valid chunk
        return 0;
    }

    if (type) {
      if (!number && number !== 0) {
        throw new Error(
          'invalid duration value: Missing number before "' + letter + '"'
        );
      }
      var num = parseInt(number, 10);
      if (ICAL.helpers.isStrictlyNaN(num)) {
        throw new Error(
          'invalid duration value: Invalid number "' + number + '" before "' + letter + '"'
        );
      }
      object[type] = num;
    }

    return 1;
  }
function parseDurationChunk(letter, number, object) {
    var type;
    switch (letter) {
      case 'P':
        if (number && number === '-') {
          object.isNegative = true;
        } else {
          object.isNegative = false;
        }
        // period
        break;
      case 'D':
        type = 'days';
        break;
      case 'W':
        type = 'weeks';
        break;
      case 'H':
        type = 'hours';
        break;
      case 'M':
        type = 'minutes';
        break;
      case 'S':
        type = 'seconds';
        break;
      default:
        // Not a valid chunk
        return 0;
    }

    if (type) {
      if (!number && number !== 0) {
        throw new Error(
          'invalid duration value: Missing number before "' + letter + '"'
        );
      }
      var num = parseInt(number, 10);
      if (ICAL.helpers.isStrictlyNaN(num)) {
        throw new Error(
          'invalid duration value: Invalid number "' + number + '" before "' + letter + '"'
        );
      }
      object[type] = num;
    }

    return 1;
  }
function parseDurationChunk ( letter , number , object ) { var type ; switch ( letter ) { case 'P' : if ( number && number === '-' ) { object . isNegative = true ; } else { object . isNegative = false ; } // period break ; case 'D' : type = 'days' ; break ; case 'W' : type = 'weeks' ; break ; case 'H' : type = 'hours' ; break ; case 'M' : type = 'minutes' ; break ; case 'S' : type = 'seconds' ; break ; default : // Not a valid chunk return 0 ; } if ( type ) { if ( ! number && number !== 0 ) { throw new Error ( 'invalid duration value: Missing number before "' + letter + '"' ) ; } var num = parseInt ( number , 10 ) ; if ( ICAL . helpers . isStrictlyNaN ( num ) ) { throw new Error ( 'invalid duration value: Invalid number "' + number + '" before "' + letter + '"' ) ; } object [ type ] = num ; } return 1 ; }
Internal helper function to handle a chunk of a duration.

@param {String} letter type of duration chunk
@param {String} number numeric value or -/+
@param {Object} dict target to assign values to
Internal helper function to handle a chunk of a duration .