IdGen
IdGen copied to clipboard
Is there a way to generate id from the past
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?
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.