malcommac/SwiftDate
60.0
Adequate · 27 September 2026
7k
lines of production code
Swift
primary language
4
measurements over time
What this system is
SwiftDate is a Swift library that provides comprehensive date and time manipulation, parsing, and formatting capabilities across Apple platforms and Linux. It features a protocol-oriented architecture with explicit region handling for calendars, timezones, and locales, alongside support for various date string formats including ISO8601, .NET, and RSS. The system also includes robust APIs for managing date ranges and time periods, enabling complex comparisons, overlaps, and sequential scheduling logic.
How it got here
2015–2016 — Swift 5 migration and CI setup
6 changes.
The project underwent a structural migration to support Swift 5 and Carthage integration, reorganizing the Xcode project into distinct modules. This period also established a robust continuous integration pipeline and comprehensive unit test coverage for core date functionality across multiple Apple platforms.
2017–2020 — Swift 5.0 API overhaul and TimePeriod expansion
15 changes.
This period focused on a major API refactoring for Swift 5.0 compatibility, introducing the DateInRegion struct to explicitly handle calendar regions and overhauling date arithmetic and comparison methods. The library significantly expanded its capabilities with a new TimePeriod API for managing date ranges and groups, alongside enhanced parsing support for formats like DotNet and ISO8601. Infrastructure improvements included adding Linux test runner support via Sourcery and establishing a structured playground for documentation.
Features
Added Sourcery template to generate LinuxMain for testing
A new Sourcery stencil file (.sourcery/LinuxMain.stencil) has been added to automatically generate the LinuxMain.swift file required for running XCTest suites on Linux. This template iterates over all classes extending XCTestCase, identifies test methods, and constructs the necessary XCTestMain registration, enabling seamless test execution on Linux platforms without manual boilerplate.
.sourcery · high confidence
Added SwiftDate playground documentation pages
New interactive playground pages have been added to the SwiftDate documentation, covering Introduction, Date Parsing, Date Manipulation, Date Formatting, and Compare Dates. These pages provide code examples and explanations for core library features such as creating DateInRegion instances, parsing various date formats (ISO8601, .NET, RSS, SQL), manipulating dates with time units, formatting output, and comparing date instances.
Playgrounds/SwiftDate.playground/Pages · high confidence
Added SwiftDate playground with structured documentation pages
A new playground file has been added to the repository, providing a structured environment for exploring SwiftDate features. It includes dedicated pages for Introduction, Date Parsing, Date Manipulation, Compare Dates, and Date Formatting, allowing users to interactively learn and test library capabilities.
Playgrounds/SwiftDate.playground · high confidence
Added iOS Test Application scaffolding
A new iOS test application (TestApplication) has been added to the project, providing a standard Xcode project structure including AppDelegate, ViewController, storyboards, asset catalogs, and Info.plist. This serves as a local environment for testing the library's functionality on iOS devices and simulators.
TestApplication · high confidence
Introduction of DateRepresentable protocol and SwiftDate struct
This change introduces the \DateRepresentable\ protocol, which defines a comprehensive set of date component properties (such as \year\, \month\, \day\, \quarter\, \ordinalDay\) and formatting methods (like \weekdayName\, \quarterName\, \eraName\) that now accept optional locale overrides. It also adds the \SwiftDate\ struct, which exposes a \defaultRegion\ (defaulting to UTC) and manages \autoFormats\ for string parsing. These additions provide a structured, protocol-oriented foundation for date manipulation and locale-aware formatting within the library.
Sources/SwiftDate · high confidence
New Date extension methods for comparison, creation, and arithmetic
This change introduces a comprehensive set of new methods on the standard \Date\ type to simplify date manipulation and comparison. Users can now compare dates with specific granularity using \isBeforeDate\, \isAfterDate\, and \isInRange\, or check if dates are close to each other with \compareCloseTo\. New creation helpers allow rounding dates (\dateRoundedAt\), setting specific time components (\dateBySet\), and enumerating date ranges (\enumerateDates\). Additionally, mathematical operators (\+\, \-\) are now supported for adding/subtracting \DateComponents\ and \TimeInterval\s to dates, and utility methods like \earlierDate\, \laterDate\, and \difference\ are available for easier date arithmetic.
Sources/SwiftDate/Date · high confidence
New DotNet date format support and ISO8601 formatting options
SwiftDate now supports parsing and formatting Microsoft DotNet date strings (e.g., /Date(1268123281843)/) via the new DOTNETParser and DOTNETFormatter classes, accessible through the dotNet style in DateToStringStyles and StringToDateStyles. Additionally, ISO8601 output can now be customized with the .withoutTZSeparators option to produce timezones like +0200 instead of +02:00, and the ISO parser has been updated to consistently use the English (US) locale and Gregorian calendar for parsing to ensure reliability across different system settings.
Sources/SwiftDate/Formatters · high confidence
New TimePeriod API for managing and comparing date ranges
The library introduces a new \TimePeriod\ type (backed by \TimePeriodProtocol\) that allows users to define, manipulate, and compare date ranges. Users can now create periods with specific start/end dates or durations, shift them in time, and lengthen or shorten them anchored at the beginning, end, or center. The API also provides methods to determine relationships between periods, such as checking if one is inside another, if they overlap or intersect, and calculating gaps between them.
Sources/SwiftDate/TimePeriod · high confidence
New TimePeriodChain and TimePeriodCollection types for managing groups of time periods
This change introduces two new types for organizing multiple time periods: TimePeriodChain, which manages tightly coupled, non-overlapping sequential periods (ideal for schedules like meetings), and TimePeriodCollection, which handles loose sets of periods that may overlap. TimePeriodChain provides methods to append, insert, remove, and shift periods while automatically maintaining chain continuity and updating start/end dates. TimePeriodCollection offers flexible manipulation and powerful sorting capabilities (by start, end, duration, or custom functions), along with query methods to find periods inside, intersected by, or overlapped by a given period or date. Both types conform to TimePeriodGroup, providing a common interface for accessing the group's overall start, end, duration, and count, as well as standard sequence operations like iteration, mapping, and filtering.
Sources/SwiftDate/TimePeriod/Groups · high confidence
New date component shortcuts and string parsing extensions
This change introduces new convenience extensions for Swift's Foundation types to simplify date manipulation and parsing. Int literals now support direct conversion to DateComponents via properties like .days, .hours, and .weeks, enabling intuitive arithmetic (e.g., 5.days). String gains a DateParsable protocol with methods to parse ISO8601, RSS, SQL, and DotNET formats, plus a new .asLocale() helper. DateComponents receives new utilities such as .fromNow, .ago, and arithmetic operators (+/-). Additionally, TimeInterval gains a toIntervalString() method with customizable formatting options and a toClock() method for positional time display.
Sources/SwiftDate/Foundation+Extras · high confidence
Behavioural changes
Added Xcode configuration plists for framework and test bundle
New Info.plist files have been added for the SwiftDate framework and its test bundle, standardizing build configuration attributes such as bundle identifiers, package types (FMWK and BNDL), and version strings.
Configs · high confidence
Added Xcode workspace configuration for Carthage integration
The project now includes a standard Xcode workspace structure (contents.xcworkspacedata and IDEWorkspaceChecks.plist) to support Carthage dependency management, allowing users to integrate SwiftDate via Carthage alongside existing CocoaPods support.
SwiftDate.xcodeproj/project.xcworkspace · medium confidence
Added Xcode workspace configuration for Swift Package Manager
A new Xcode workspace file (contents.xcworkspacedata) has been added to the .swiftpm directory, enabling the package to be opened and edited directly within Xcode. This change supports the upgrade to Swift Package Manager 5.1 by providing the necessary workspace structure for IDE integration.
.swiftpm · medium confidence
Refactored date parsing and introduced structured date components
The library's date parsing logic has been refactored to use a new \DateFormats\ configuration in \Commons.swift\, which defines a list of built-in auto-parsing formats (including ISO 8601, HTTP headers, and RSS) and provides a \parse\ method that cycles through them. Additionally, new structured types have been added to represent calendar components: \Year\ and \Month\ structs/enums in \TimeStructures.swift\ provide methods for leap year checks, day counts, and arithmetic, while \WeekDay\ gains \add\ and \subtract\ capabilities. Support for these components is extended via new \Calendar.Identifier\ encoding in \Calendars.swift\ and comprehensive locale/timezone enums in \Locales.swift\ and \Zones.swift\.
Sources/SwiftDate/Supports · high confidence
SwiftDate 5.0: Major API overhaul with new DateInRegion structure
The library has been refactored for Swift 5.0 compatibility, introducing a new \DateInRegion\ struct that explicitly pairs a \Date\ with a \Region\ (calendar, timezone, and locale) to replace previous implicit handling. This change brings breaking API modifications: the subtraction operator (\-\) between two dates now returns a \TimeInterval\ instead of \DateComponents\ (use the new \componentsTo\ or \componentsSince\ methods for component-based differences), and the \dateAt(.startOfMonth)\ behavior has been corrected to align with standard calendar boundaries. Additionally, random date generation now uses the Swift 4.2+ \random\ API for better Linux compatibility, and the \Region\ type now supports \Codable\ encoding/decoding for serialization.
Sources/SwiftDate/DateInRegion · high confidence
SwiftDate Xcode project structure reorganized for Swift 5 and Carthage
The SwiftDate Xcode project has been restructured to support Swift 5 compatibility and improved Carthage integration. This change introduces a new project file that organizes source files into distinct modules (such as DateInRegion, Region, Zones, Calendars, and Locales) and adds support for multiple platforms including iOS, tvOS, watchOS, and macOS. The project now includes specific build configurations for Carthage, ensuring that the framework can be built and distributed more effectively across different Apple platforms.
SwiftDate.xcodeproj · medium confidence
Updated Xcode project schemes for iOS, macOS, tvOS, and watchOS
The Xcode project schemes for the iOS, macOS, tvOS, and watchOS targets have been regenerated and updated to version 1.3 (Xcode 12.20). These changes configure the build actions to parallelize buildables and include explicit build entries for testing, running, profiling, archiving, and analyzing. Additionally, code coverage is now enabled for the test actions on iOS, macOS, and tvOS, ensuring that test execution reports coverage metrics for these platforms.
SwiftDate.xcodeproj/xcshareddata · high confidence
Test coverage
Added Linux test runner via Sourcery; Added comprehensive unit tests for SwiftDate core components; Initial project scaffolding and CI configuration.
Dependencies
SwiftDate 7.0.0 release with updated platform support
The SwiftDate library has been updated to version 7.0.0, introducing new minimum deployment targets for Apple platforms: iOS 13, macOS 10.15, watchOS 6, and tvOS 13. The package now supports Swift 5.5 and includes configuration for both CocoaPods and Swift Package Manager, with specific resource handling for localization files in the RelativeFormatter.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 52 → 60 (+8.3)
- Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 90 (-10.0)
- Architecture 89 (new)
- Maturity 54 → 48 (-6.6)
- Readiness 28 → 53 (+24.8)
- Security 100 → 90 (-10.0)
Resolved (9)
- Dimension evaluation failed
- No automated tests
- No context/problem statement and no explicit decision; only an unrelated project list is visible (Documentation/11.Related_Projects.md)
- No exposed public API
- No tests found
- Test reliability not included
- early-stage repository — too little history to judge knowledge freshness
- single-commit history — no usable git history window to measure hotspots
- single-maintainer — knowledge-concentration (bus factor) risk
New (53)
- Assertions commented out: testDateInRegion_Hash (Tests/SwiftDateTests/TestDateInRegion.swift)
- ClassTooLong: ISOParser (Sources/SwiftDate/Formatters/ISOParser.swift)
- ClassTooLong: Locales (Sources/SwiftDate/Supports/Locales.swift)
- ClassTooLong: Zones (Sources/SwiftDate/Supports/Zones.swift)
- Coverage not measured — Swift suite
- DateInRegion.compare (cyclomatic 35) (Sources/SwiftDate/DateInRegion/DateInRegion.swift)
- Dependency hygiene PARTLY measured — SwiftPM pinning read, dependency currency NOT established
- Dormant codebase
- Duplicate functionality across types. SwiftDate (likely a namespace or singleton type) and DateFormats both expose a resetAutoFormats method. Since DateFormats also holds the autoFormats property, the method on SwiftDate is redundant or implies a global state that should be encapsulated within DateFormats.
- Duplicated block (10 lines × 2) (Sources/SwiftDate/Date/Date.swift)
- Duplicated block (11 lines × 2) (Sources/SwiftDate/TimePeriod/Groups/TimePeriodGroup.swift)
- Duplicated block (13 lines × 2) (Sources/SwiftDate/TimePeriod/Groups/TimePeriodChain.swift)
- Duplicated block (5 lines × 2) (Sources/SwiftDate/Date/Date+Create.swift)
- Duplicated block (7 lines × 2) (Sources/SwiftDate/Date/Date+Create.swift)
- Duplicated block (9 lines × 2) (Sources/SwiftDate/DateRepresentable.swift)
- Duplicated block (9 lines × 2) (Sources/SwiftDate/TimePeriod/TimePeriodProtocol.swift)
- FileTooLong: Formatters/ISOParser.swift (Sources/SwiftDate/Formatters/ISOParser.swift)
- FileTooLong: Supports/Locales.swift (Sources/SwiftDate/Supports/Locales.swift)
- ISOParser.parse (cognitive 83) (Sources/SwiftDate/Formatters/ISOParser.swift)
- ISOParser.parse (cyclomatic 43) (Sources/SwiftDate/Formatters/ISOParser.swift)
- …and 33 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
malcommac/SwiftDate was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 27 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 5d943224c3bb173e6ecf27295611615eba90c80e — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-d00c643c3f66.