function parseTimestamp(value, unit = null, local = false) {
  let m;
  if (moment.isMoment(value)) {
    m = value;
  } else if (typeof value === "string" && /(Z|[+-]\d\d:?\d\d)$/.test(value)) {
    m = moment.parseZone(value);
  } else if (unit in TEXT_UNIT_FORMATS && typeof value === "string") {
    m = TEXT_UNIT_FORMATS[unit](value);
  } else if (unit in NUMERIC_UNIT_FORMATS && typeof value == "number") {
    m = NUMERIC_UNIT_FORMATS[unit](value);
  } else {
    m = moment.utc(value);
  }
  return local ? m.local() : m;
}
// moment normally interprets the DD in YYYY-MM-DD as an offset :-/
moment normally interprets the DD in YYYY-MM-DD as an offset .
moment normally interprets the DD in YYYY - MM - DD as an offset .
function parseTimestamp(value, unit = null, local = false) {
  let m;
  if (moment.isMoment(value)) {
    m = value;
  } else if (typeof value === "string" && /(Z|[+-]\d\d:?\d\d)$/.test(value)) {
    m = moment.parseZone(value);
  } else if (unit in TEXT_UNIT_FORMATS && typeof value === "string") {
    m = TEXT_UNIT_FORMATS[unit](value);
  } else if (unit in NUMERIC_UNIT_FORMATS && typeof value == "number") {
    m = NUMERIC_UNIT_FORMATS[unit](value);
  } else {
    m = moment.utc(value);
  }
  return local ? m.local() : m;
}
function parseTimestamp ( value , unit = null , local = false ) { let m ; if ( moment . isMoment ( value ) ) { m = value ; } else if ( typeof value === "string" && / (Z|[+-]\d\d:?\d\d)$ / . test ( value ) ) { m = moment . parseZone ( value ) ; } else if ( unit in TEXT_UNIT_FORMATS && typeof value === "string" ) { m = TEXT_UNIT_FORMATS [ unit ] ( value ) ; } else if ( unit in NUMERIC_UNIT_FORMATS && typeof value == "number" ) { m = NUMERIC_UNIT_FORMATS [ unit ] ( value ) ; } else { m = moment . utc ( value ) ; } return local ? m . local ( ) : m ; }
moment normally interprets the DD in YYYY-MM-DD as an offset :
moment normally interprets the DD in YYYY - MM - DD as an offset :