SwiftMoment alternatives and similar libraries
Based on the "Date" category.
Alternatively, view SwiftMoment alternatives based on common mentions on social networks and blogs.
SwiftDate9.7 0.0 L3 SwiftMoment VS SwiftDate🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
Timepiece8.7 0.0 L5 SwiftMoment VS TimepieceIntuitive date handling in Swift
Chronology8.3 0.0 SwiftMoment VS ChronologyBuilding a better date/time library for Swift
NSDate-Extensions8.1 0.0 SwiftMoment VS NSDate-ExtensionsPractical real-world dates
AFDateHelper8.0 0.0 L2 SwiftMoment VS AFDateHelperA Swift Date extension helper
SwiftyTimer7.6 0.0 L5 SwiftMoment VS SwiftyTimerSwifty API for NSTimer
Time7.0 0.0 SwiftMoment VS Time🕰 Type-safe time calculations in Swift
TrueTime.swift6.4 0.0 L5 SwiftMoment VS TrueTime.swiftNTP library for Swift and Objective-C. Get the true time impervious to device clock changes.
Punctual.swift4.3 0.0 L5 SwiftMoment VS Punctual.swiftSwift date handler.
Datez4.1 0.0 L5 SwiftMoment VS Datez📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
NVDate3.7 0.0 SwiftMoment VS NVDate📅 Swift4 Date extension library
AnyDate3.5 0.0 SwiftMoment VS AnyDateSwifty Date & Time API inspired from Java 8 DateTime API.
Tempo3.1 0.0 L4 SwiftMoment VS Tempo:watch: Date and time manager for iOS/OSX written in Swift
Datify1.3 0.0 SwiftMoment VS DatifyEasypeasy date functions. 🕛
Swift-NSDate-Extensions1.0 0.0 L5 SwiftMoment VS Swift-NSDate-ExtensionsSwift NSDate Extension to help development
CalendarDate0.3 0.0 SwiftMoment VS CalendarDateNaive date and time for Swift
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SwiftMoment or a related project?
This framework is inspired by Moment.js. Its objectives are the following:
- Simplify the manipulation and readability of date and interval values.
- Provide help when parsing dates from various string representations.
- Simplifying the formatting of date information into strings.
- Streamlining getting date components (day, month, etc.) from dates and time intervals.
Important: This framework supports iOS 9+, macOS 10.11+, tvOS 9+, watchOS 2+, Xcode 8 and Swift 3.
SwiftMoment is compatible with Carthage and CocoaPods. With CocoaPods, just add this to your Podfile:
SwiftMoment can also be used via the Swift Package Manager. Just add it to the dependencies in your Package.swift file:
let package = Package( name: "MyPackage", dependencies: [ ... .package(url: "https://github.com/akosma/SwiftMoment.git", from: "0.7.1"), ], ... )
Mac OS X Notes
- Drag the created .framework file into the Xcode Project, be sure to tick 'Copy Files to Directory'
- In the containing applications target, add a new 'Copy File Build Phase'
- Set the 'Destination' to 'Frameworks'
- Drag in the created .framework
To use this library, just
import SwiftMoment in your application.
To create new moment instances:
let now = moment() let yesterday = moment("2015-01-19")
By default, moments are initialized with the current date and time. You can create moments for any... moment in the future or the past; you can do that by passing strings in different formats:
let yesterday = moment("2015-01-19")
You can also do it by directly specifying the components manually:
let today = moment([2015, 01, 19, 20, 45, 34])
You can also use a dictionary with the following keys:
let obj = moment(["year": 2015, "second": 34, "month": 01, "minute": 45, "hour": 20, "day": 19 ])
When using a
[String: Int] dictionary, the order of the keys does not
matter. Moreover, only the keys above are taken into account, and any
other information is ignored.
There is also an extension to the
Int type in Swift, used to create
Duration values directly from an integer value:
let duration = 5.hours + 56.minutes
The two most important components of this library are the
Moment wraps an
NSDate instance, while
Duration wraps an
Duration comply with the
Comparable protocols, and
include all the required operators. In addition,
Moment instances can
be subtracted from one another (which yields a
Duration instances can be added to
Moments to create new moments.
Durations are made as immutable as possible.
Swift Moment includes a suite of tests showing how to use the different functions of the framework.
To run the Linux tests in a macOS environment, please use the included Dockerfile:
docker build --tag swiftmoment . docker run --rm swiftmoment
A playground is included in the project to learn how to use the library.
Differences with Moment.js
- Format strings
dddo not yield the same results.
Lots of people are actively helping in the development of this library; please check the CONTRIBUTORS file for the full list! Thanks to all :)
This project is distributed under a BSD license. See the LICENSE file for details.
*Note that all licence references and agreements mentioned in the SwiftMoment README section above are relevant to that project's source code only.