datoit-utils
Version:
Shared utilities for the Datoit packages
14 lines (10 loc) • 308 B
JavaScript
;
// Using timestamp (milliseconds) to be sure it is unique
// + converting timestamp to base 36 for better readibility
const generateTimestampCode = date => {
const referDate = date || new Date();
return referDate.getTime().toString(36);
};
module.exports = {
generateTimestampCode,
};