Jiffy.unix constructor

Jiffy.unix(
  1. int timestamp
)

Implementation

Jiffy.unix(int timestamp) {
  var timestampLength = timestamp.toString().length;
  if (timestampLength != 10 && timestampLength != 13) {
    throw JiffyException(
            'The timestamp passed must be in seconds or millisecods e.g. 1570963450 or 1570963450123')
        .cause;
  }
  if (timestampLength == 10) timestamp *= 1000;
  _dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp);
}