diff --git a/ui/src/assets/Model.ts b/ui/src/assets/Model.ts new file mode 100644 index 0000000..53ca388 --- /dev/null +++ b/ui/src/assets/Model.ts @@ -0,0 +1,12 @@ +export class Model { + public get hash(): string { + const str = JSON.stringify(this); + + // source: https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0?permalink_comment_id=2775538#gistcomment-2775538 + let hash = 0; + for (let i = 0; i < str.length; i++) + hash = Math.imul(31, hash) + str.charCodeAt(i) | 0; + + return new Uint32Array([hash])[0].toString(36); + } +} diff --git a/ui/src/components/calendar/CalendarCarousel.vue b/ui/src/components/calendar/CalendarCarousel.vue index a37c996..9d00441 100644 --- a/ui/src/components/calendar/CalendarCarousel.vue +++ b/ui/src/components/calendar/CalendarCarousel.vue @@ -16,7 +16,7 @@