diff --git a/ui/src/components/calendar/event.ts b/ui/src/components/calendar/event.ts index d26f37b..be016cf 100644 --- a/ui/src/components/calendar/event.ts +++ b/ui/src/components/calendar/event.ts @@ -18,13 +18,11 @@ export default class Event { public get hash(): string { const str = JSON.stringify(this); - // from https://gist.github.com/jlevy/c246006675becc446360a798e2b2d781 + // source: https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0?permalink_comment_id=2775538#gistcomment-2775538 let hash = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash = (hash << 5) - hash + char; - hash &= hash; // Convert to 32bit integer - } + for (let i = 0; i < str.length; i++) + hash = Math.imul(31, hash) + str.charCodeAt(i) | 0; + return new Uint32Array([hash])[0].toString(36); } } \ No newline at end of file