-
-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extracting time from v1 uuid #49
Conversation
Any plans to merge this? |
Sorry for not responding earlier - I'm afraid this fell off my radar. (Feel free to harass me if you don't feel I'm responding fast enough in the future, btw) There's been more than one request for the ability to parse fields out of UUIDs, and this obviously fits in nicely with that. However my suspicion is that a relatively small %'age of the people generating IDs need a parsing feature. Thus, I'm a little reluctant to add this as part of the core module. Ideally I'd like to break this code apart such that people who only need to generate v4 UUIDs can do so without incurring the code bloat that goes along with v1 generation and parsing. If anyone has ideas on the best way to do that I'd love to hear them. For my part, I'm thinking this may take the form of separate modules for:
... and have a build script of some sort that compiles these together into a single uuid.js file. This way people can (for example) only use the uuid-v4 module if they don't want/need the code necessary for supporting v1 generation and parsing. Anyhow... my point is that I see this as version 2 functionality. Thoughts? |
Major +1 to merge. Props to you, @krassif. |
+1 this is really useful thing to add.. plz add this if possible |
big +1 |
Yes this would seem to be useful for Cassandra users where you can combine a row's created_at timestamp with the row's id. But when you display the row you will have to be able to extract the timestamp from the time uuid. As long as the pull request is correct I support a merge. I think the package is still far from being bloated. And won't the performance conscious users who use this package in a low spec mobile browser optimize out the v1 functions when minimizing their JS code anyway? Also, @ronkorving 久しぶりです |
This seems like a useful feature for v1 uuids to warrant inclusion. |
I went ahead and patched this myself and it works splendidly. Broofa, this is way too useful not to incorporate as people need to convert both directions. +1 and a half. |
It's only been 2 years now. Still within reason to discuss architecture ;) Get this in already please. |
+1 from me as well. |
Is this going to be patched anytime soon? |
FWIW, 👍 from me as well. I will bother @broofa over email since he said I should 😄 |
But unfortunately, this does not work ... v1time(uuid.v1());
Error: uuid version 1 expected |
Sorry I was mistaken, it does work, but imho the above API is important to have working. The correct way to use this in it's current form is:
|
FYI I ripped this out into a module. Thanks @krassif for writing it. I attributed you in the README and also implemented optional parsing from strings. https://github.com/indexzero/uuid-time |
Added a method to extract msecs from v1 type uuid. I saw uuidjs had low/high time, but it would be better if everything was in a single, well performing library.