function GedcomXDate(str) {

  if(str == '') {
    throw new Error('Invalid Date');
  }

  if(str.charAt(0) == 'R') {
    return new Recurring(str);
  } else if(/\//.test(str)) {
    return new Range(str);
  } else if(str.charAt(0) == 'A') {
    return new Approximate(str);
  } else {
    return new Simple(str);
  }
}
function GedcomXDate(str) {

  if(str == '') {
    throw new Error('Invalid Date');
  }

  if(str.charAt(0) == 'R') {
    return new Recurring(str);
  } else if(/\
    return new Range(str);
  } else if(str.charAt(0) == 'A') {
    return new Approximate(str);
  } else {
    return new Simple(str);
  }
}
function GedcomXDate ( str ) { if ( str == '' ) { throw new Error ( 'Invalid Date' ) ; } if ( str . charAt ( 0 ) == 'R' ) { return new Recurring ( str ) ; } else if ( / \/ / . test ( str ) ) { return new Range ( str ) ; } else if ( str . charAt ( 0 ) == 'A' ) { return new Approximate ( str ) ; } else { return new Simple ( str ) ; } }
A GedcomX Date.
This will parse the passed in string and return
the appropriate GedcomX Date object.
A GedcomX Date . This will parse the passed in string and return the appropriate GedcomX Date object .