textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
18 lines (17 loc) • 463 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.timestampToDate = void 0;
/**
* Converts a protobuf timestamp into a Javascript Date
*
* ```typescript
* utils.timestampToDate(timestamp);
* ```
*/
function timestampToDate(timestamp) {
const milliseconds = timestamp
? timestamp.seconds * 1e3 + timestamp.nanos / 1e6
: 0;
return new Date(milliseconds);
}
exports.timestampToDate = timestampToDate;
;