Swiftpack.co - regattaguru/TAI64n as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by regattaguru.
regattaguru/TAI64n v0.1.0-beta
Swift package implementing TAI64n label parsing to create a Date object, and a getter property to produce a TAI64n label.
⭐️ 0
🕓 1 year ago
.package(url: "https://github.com/regattaguru/TAI64n.git", from: "v0.1.0-beta")

TAI64n

Swift package offering TAI64n label parsing to create a Date object, and a getter property to produce a TAI64n label.

It is implemented as an extension to the Date object

Caveats

  • It produces a full nanosecond component in the label which, when parsed will very likely not match the original. Ignoring the last byte of the label should be reliable.
  • It is probably slow.
  • It uses the new RegexBuilder because it can, and it is probably efficient, but it does mean that MacOS 13, iOS 16, tvOS 16, or WatchOS 9 is required.

Usage

init?(tai64nLabel: String) -> Date?
tai64nlabel: String

Example

let dt = Date(tai64nLabel: "@400000000000000000000000") // 1969-12-31T23:59:50.000
dt?.tai64nlabel // @400000000000000000000000

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Initial
1 year ago

Only tested for rudimentary and some edge cases

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics