Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: fix object id date parsing

Abdullah Attad9ff5e0053b1
diff --git a/packages/core/src/utils/object-id.ts b/packages/core/src/utils/object-id.ts
index a78b5ce9c..331834b93 100644
--- a/packages/core/src/utils/object-id.ts
+++ b/packages/core/src/utils/object-id.ts
@@ -39,12 +39,5 @@ function swap16(val: number) {
}
export function getObjectIdTimestamp(id: string) {
- const timestamp = new Date();
- const time =
- id.charCodeAt(3) |
- (id.charCodeAt(2) << 8) |
- (id.charCodeAt(1) << 16) |
- (id.charCodeAt(0) << 24);
- timestamp.setTime(Math.floor(time) * 1000);
- return timestamp;
+ return new Date(parseInt(id.substring(0, 8), 16) * 1000);
}