
* Add helper texts * Add instruction components * Add changeset * Fix new tab opening * Update and move id generation to the single location * Remove unused code * Apply suggestions from code review Co-authored-by: Dawid <tarasiukdawid@gmail.com> --------- Co-authored-by: Dawid <tarasiukdawid@gmail.com>
10 lines
394 B
TypeScript
10 lines
394 B
TypeScript
/**
|
|
* Generates a random id containing current time and random string.
|
|
*/
|
|
export const generateRandomId = () => {
|
|
const date = new Date();
|
|
const offsetInMinutes = date.getTimezoneOffset();
|
|
const randomDate = date.setMinutes(date.getMinutes() + offsetInMinutes).valueOf();
|
|
const randomString = (Math.random() + 1).toString(36).substring(7);
|
|
return `${randomDate}${randomString}`;
|
|
};
|