lib/identity.js
function _toDate (ndate, nrandom, nchecksum, epoc, id) {
  // Guard
  if (!_isValid(ndate, nrandom, nchecksum, id)) throw new Error('identity#toDate: Invalid Id');

  // Calculate
  var bits = baseURL.decode(id),
    dateBits = bits.slice(0, ndate);
  return new Date(parseInt(dateBits, 2) + epoc.getTime());
}
function _toDate (ndate, nrandom, nchecksum, epoc, id) {
  // Guard
  if (!_isValid(ndate, nrandom, nchecksum, id)) throw new Error('identity#toDate: Invalid Id');

  // Calculate
  var bits = baseURL.decode(id),
    dateBits = bits.slice(0, ndate);
  return new Date(parseInt(dateBits, 2) + epoc.getTime());
}
function _toDate ( ndate , nrandom , nchecksum , epoc , id ) { // Guard if ( ! _isValid ( ndate , nrandom , nchecksum , id ) ) throw new Error ( 'identity#toDate: Invalid Id' ) ; // Calculate var bits = baseURL . decode ( id ) , dateBits = bits . slice ( 0 , ndate ) ; return new Date ( parseInt ( dateBits , 2 ) + epoc . getTime ( ) ) ; }
Get date from id
@private
@param  {integer} ndate     Size of date bits
@param  {integer} nrandom   Size of random bits
@param  {integer} nchecksum Size of checksum bits
@param  {Date} epoc         Epoc to use
@param  {string}  id        BaseURL encoded Id to test
@return {Date}              The date of id creation
Get date from id