Naive date and times for Swift

Overview

Build

CalendarDate

Calendar dates for Swift, built around DateComponents. Provides value objects for representing dates and times that are not directly bound to specific UTC offsets or timezones. This is useful when working with future events, as in the case of event and appointment scheduling apps.

CalendarDate provides the following value types:

  • CalendarTime: Represents a wall time, such as "2:00PM".
  • CalendarDate: Represents a calendar date, such as a birthday.
  • CalendarDateTime: Groups CalendarDate and CalendarTime to represent a date + time.

How to use it

You can initialize a CalendarDateTime value directly and convert it to a Swift Date when you need to display it to the user.

let meetingDate = CalendarDateTime(year: 2020, month: 4, day: 1, hour: 10, minute: 30)
let meetingTimezone = TimeZone(identifier: "America/New_York")

let date = meetingDate.asDate(timezone: meetingTimezone!)

let formatter = DateFormatter()
formatter.dateStyle = .long
formatter.timeStyle = .long
formatter.timeZone = TimeZone(identifier: "America/New_York") // Or .current

formatter.string(from: date) // -> "April 1, 2020 at 10:30:00 AM EDT"

Codable

The value types provided by this library all conform to Codable.

Value Type Codable format
CalendarTime hh:mm:ss
CalendarDate YYYY-MM-DD
CalendarDateTime YYYY-MM-DDThh:mm:ss

Recommended reads

You might also like...
DateHelper - A high performant Swift Date Extension for creating, converting, comparing, or modifying dates.
DateHelper - A high performant Swift Date Extension for creating, converting, comparing, or modifying dates.

DateHelper A high performant Swift Date Extension for creating, converting, comparing, or modifying dates. Capabilities Creating a Date from a String

Intuitive date handling in Swift

Timepiece Intuitive date handling in Swift Features 💡 Intuitive: Timepiece provides a set of helpers to make date handling easier. 🕘 Correct: Using

Elegant NTP date library in Swift
Elegant NTP date library in Swift

Kronos is an NTP client library written in Swift. It supports sub-seconds precision and provides a stable monotonic clock that won't be affected by ch

Building a better date/time library for Swift

Time Time is a Swift package that makes dealing with calendar values a natural and straight-forward process. Working with calendars can be extremely c

Swift Date Formatter

Swift Date Formatter Date Formatter - Sample code on how to use Date Formatter in swift language Author: Denow Cleetus For OSSE Assignment 4 Group 24

NasaApod - iOS, Swift, MVVM, Consuming NASA Astronomy Picture of the Day API for any selected date

NasaApod iOS, Swift, MVVM, Unit Tests Consuming NASA Astronomy Picture of the Da

🎗 Super lightweight ISO8601 Date Formatter in Swift
🎗 Super lightweight ISO8601 Date Formatter in Swift

ISO8601 ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcut mana

Swifty Date & Time API inspired from Java 8 DateTime API.

AnyDate Swifty Date & Time API inspired from Java 8 DateTime API. Background I think that date & time API should be easy and accurate. Previous dates,

Datify 🕛 Easypeasy date functions.

Datify 🕛 Easypeasy date functions.

Owner
Ramon Torres
Ninja
Ramon Torres
A Swift micro library for generating Sunrise and Sunset times.

Solar A Swift helper for generating Sunrise and Sunset times. Solar performs its calculations locally using an algorithm from the United States Naval

Chris Howell 493 Dec 25, 2022
Custom Time Picker ViewController with Selection of start and end times in Swift 🔶

LFTimePicker Custom Time Picker ViewController with Selection of start and end times in Swift ?? . Based on Adey Salyard's design @ Dribbble One to tw

Awesome Labs 65 Nov 11, 2022
Dates and times made easy in iOS

DateTools DateTools was written to streamline date and time handling in iOS. Classes and concepts from other languages served as an inspiration for Da

Matthew York 7.2k Dec 30, 2022
Typical master detail SAMPLE application written in Swift to test NY Times Most Popular API

NYTimes-Demo: Typical master detail SAMPLE application written in Swift to test NY Times Most Popular API. This SAMPLE application is written in Swift

Atif Naveed 0 Nov 3, 2021
🕐 Format your dates/times as emojis.

EmojiTimeFormatter Format your dates/times as emojis ?? ?? ?? Description You can build easy to understand user interfaces with EmojiTimeFormatter or

Thomas Paul Mann 80 Feb 7, 2022
A basic countdown app that allows the user to create, edit, and delete events. Each event contains a live countdown timer to a specified date and time.

Event Countdown App (iOS) Created by Lucas Ausberger About This Project Created: January 4, 2021 Last Updated: January 8, 2021 Current Verison: 1.1.1

Lucas Ausberger 1 Jan 8, 2022
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!

Datez ?? Breeze through Date, DateComponents, and TimeInterval Highlights Two Custom Structs Only (value types FTW!): DateView: An Date associated wit

Kitz 263 Dec 7, 2022
Date and time manager for iOS/OSX written in Swift

Tempo was designed to work both in OSX and in iOS (7.0+). Work with the time or dates can be cumbersome, iOS development. Tempo allows you to deal easly with date and time. Basics manipulations are already implemented in Tempo.

Remi ROBERT 153 Jun 3, 2021
NVDate is an extension of NSDate class (Swift4), created to make date and time manipulation easier.

NVDate is an extension of NSDate class (Swift4), created to make date and time manipulation easier. NVDate is testable and robust, we wrote intensive test to make sure everything is safe.

Noval Agung Prayogo 177 Oct 5, 2022
A customizable date picker for watchOS and SwiftUI.

Watch Date Picker A customizable date picker for watchOS and SwiftUI. Installation .package(url: "https://github.com/freyaariel/watch-date-picker.git"

Freya Ariel 30 Dec 4, 2022