We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm missing a function to get the timestamp of a ulid. Or is there a trick to get it I'm not aware of?
The text was updated successfully, but these errors were encountered:
I'm now using following code in combination with hourglass:
ulidToDateTime :: Text -> DateTime ulidToDateTime = timeGetDateTimeOfDay . Elapsed . (`div` 1000) . fromMaybe 0 . Crock.decode . unpack . Data.Text.take 10
Shame on me for the fromMaybe 😅, but I'm validating the ulid already before, so it's OK =P
fromMaybe
Sorry, something went wrong.
Better:
ulidToDateTime :: Text -> Maybe DateTime ulidToDateTime = (fmap $ timeGetDateTimeOfDay . Elapsed . (`div` 1000) ) . Crock.decode . unpack . Data.Text.take 10
My current implementation can be found at https://github.com/ad-si/TaskLite/blob/master/tasklite-core/source/Utils.hs#L83
No branches or pull requests
I'm missing a function to get the timestamp of a ulid.
Or is there a trick to get it I'm not aware of?
The text was updated successfully, but these errors were encountered: