Created
May 10, 2016 00:59
-
-
Save ryanpbrewster/4ce3ee51dd87568e49b2fd7f6051ad5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @json case class SlackTimestamp(value: String) extends Ordered[SlackTimestamp] { // channel-specific timestamp | |
| def compare(that: SlackTimestamp) = value compare that.value | |
| def toDateTime: DateTime = Try { | |
| // "The bit before the . is a unix timestamp, the bit after is a sequence to guarantee uniqueness." | |
| new DateTime(value.split('.').head.toLong * 1000) | |
| }.getOrElse(throw new Exception(s"Could not parse a date-time out of $value")) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment