DateOfEaster 1.0.1

DateOfEaster 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Michał Nierebiński.


Downloads

Total7
Week7
Month7

Installs

Apps1
Apps WeekApps This Week 1
Test Targets2
Test WeekTests This week 2
powered by Segment

GitHub

Stars1
Watchers2
Forks1
Issues0
Contributors1
Pull Requests0

Code

Files1
LOCLines of Code 78


DateOfEaster

Supported Swift version: Swift 3.0+

Supported platforms: iOS 9.0+, macOS 10.10+, tvOS 10.2+, watchOS 3.2, Ubuntu 14+

Introduction

DateOfEaster is an extension for the Date class, used for calcutation of Easter date, both western (used by Roman Catholic Church and many protestant and evangelical churches) and eastern (used by most of Eastern Orthodox Churches and Ancient Churches of the East).

You can also find eastern and western Pentecost dates with DateOfEaster.

A bit of history

Sometimes I need to find a certain Christian festive day’s date. A long ago I created a Ruby gem for this: when_easter. Now I thought to create something like this in Swift.

Installation

SPM

DateOfEaster is Swift Package Manager compatible.

Framework

You can also build DateOfEaster as a framework for iOS, macOS, tvOS or watchOS. After building it, drag the created .framework file into your Xcode project.

Usage

Find a western Easter date:

import DateOfEaster

let easter2015 = Date.westernEasterDate(year: 2015)

Find an eastern Easter date:

import DateOfEaster

let easter1983 = Date.easternEasterDate(year: 1983)

Find Pentecost dates:

import DateOfEaster

let lastYearsEasternPentecost = Date.easternPentecostDate(year: 2016)

Caveats

Date.easternEasterDate and Date.westernEasterDate return Date optional. Both eastern and western date calcutation are subject to certain limitations:

  • Western date has to be year 1583 or later. There was no Gregorian calendar before.
  • Eastern date has to be between year 1900 and 2199 due to changing time distance between Gergorian and Julian calendars.

Otherwise both functions will return nil.

Attributions

Both Easter date calcutation algorithms were taken from Wikipedia:

Tests

DateOfEaster includes a suite of tests for all functions of the library. They are tested with Xcode for iOS, macOS and tvOS. They were also run with Swift compiler under macOS and Ubuntu 14.

Playground

A playground is included in the project for you to learn how to use this library. Just build DateOfEaster iOS target and play!

License

This project is distributed under a MIT license. See the LICENSE file for details.

Author

DateOfEaster was created by Michał Nierebiński