Swiftpack.co - ralfebert/CalendarDate as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
ralfebert/CalendarDate
CalendarDate is a Swift type that represents a Date as year, month and day value.
.package(url: "https://github.com/ralfebert/CalendarDate.git", from: "0.6.1")

CalendarDate

CalendarDate is a Swift type that represents a Date as year, month and day value:

let date = CalendarDate(year: 2018, month: 5, day: 3)
let today = CalendarDate.today

Converting Foundation Date values from and to CalendarDate:

let today = CalendarDate(date: Date.now)
let date = today.date

Easy date calculations:

CalendarDate.today.adding(weeks: 3)

Formatting / parsing a ISO 8601 string ('yyyy-mm-dd'):

let string = date.description    // "2018-05-03"
let parsedDate = CalendarDate(string)

JSON coding:

JSONEncoder().encode(date)  // "2018-05-03"

GitHub

link
Stars: 4
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

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