IdGen icon indicating copy to clipboard operation
IdGen copied to clipboard

Is there a way to generate id from the past

Open andtii opened this issue 1 year ago • 1 comments

Im creating a feed and using IdGen to create time based ids to sort it and its working perfectly. But is there a way to pass in a date in history and calculate the id? Like 3 days ago or something?

andtii avatar Nov 03 '23 16:11 andtii

There isn't and you shouldn't. An ID is supposed to be an opaque, meaningless, identifier. Just because some bits are reserved for a timestamp (which helps in sorting and prevents fragmenting indexes) doesn't mean that you should rely on those bits when you need to get a timestamp. If you need to keep track of a createdate or something from an object then just store it in an extra field; don't use the ID for this.

RobThree avatar Nov 04 '23 16:11 RobThree