Swiftpack.co - pixyzehn/custom-repeat-date as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by pixyzehn.
pixyzehn/custom-repeat-date 0.2.2
A simple date extension that easily allows you to provide custom repeat date options for the Gregorian calendar.
⭐️ 5
🕓 37 weeks ago
iOS macOS
.package(url: "https://github.com/pixyzehn/custom-repeat-date.git", from: "0.2.2")

custom-repeat-date

CI

A simple date extension that easily allows you to provide custom repeat date options for the Gregorian calendar. The package has been created and used for Expenses.app, inspired by Apple Reminders and Bluebird.

Usage

let option = CustomRepeatDateOption.monthly(frequency: 3, option: .daysOfWeek(weekdayOrdinal: .second, weekday: .tuesday))
let calendar = Calendar(identifier: .gregorian)

let startDate = date(year: 2022, month: 5, day: 5)                 // 2022-05-05 22:22:22 +0000
let repeat1 = calendar.nextDate(after: startDate, option: option)! // 2022-05-10 22:22:22 +0000
let repeat2 = calendar.nextDate(after: repeat1, option: option)!   // 2022-08-09 22:22:22 +0000
let repeat3 = calendar.nextDate(after: repeat2, option: option)!   // 2022-11-08 22:22:22 +0000
let repeat4 = calendar.nextDate(after: repeat3, option: option)!   // 2023-02-14 22:22:22 +0000
let repeat5 = calendar.nextDate(after: repeat4, option: option)!   // 2023-05-09 22:22:22 +0000

To see how it works in practice, check out Examples.

ex. 1 | ex. 2 ---- | ----src="https://raw.github.com/pixyzehn/custom-repeat-date/main/ src="./Examples/image-1.png" width="320"/> |

Converting Documentation

swift package --allow-writing-to-directory ./docs \
    generate-documentation --target CustomRepeatDate --output-path ./docs \
    --transform-for-static-hosting --hosting-base-path custom-repeat-date

Previewing Documentation

swift package --disable-sandbox preview-documentation --product CustomRepeatDate

See also apple/swift-docc-plugin for more information.

GitHub

link
Stars: 5
Last commit: 12 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.2.2
37 weeks ago
  • Fix startingAfter date to include the start date

Full Changelog: https://github.com/pixyzehn/custom-repeat-date/compare/0.2.1...0.2.2

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