diff --git a/KosherSwiftNew.podspec b/KosherSwiftNew.podspec index 97ee226..d8594ac 100644 --- a/KosherSwiftNew.podspec +++ b/KosherSwiftNew.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "KosherSwiftNew" - spec.version = "1.0.9" + spec.version = "2.0.0" spec.summary = "KosherJava Zmanim API / Library ported to Swift." spec.description = "This Zmanim library is an API for a specialized calendar that can calculate different astronomical times including sunrise and sunset and Jewish zmanim or religious times for prayers and other Jewish religious duties. diff --git a/Sources/KosherSwift/hebrewcalendar/JewishCalendar.swift b/Sources/KosherSwift/hebrewcalendar/JewishCalendar.swift index 1daf959..ff2eeae 100644 --- a/Sources/KosherSwift/hebrewcalendar/JewishCalendar.swift +++ b/Sources/KosherSwift/hebrewcalendar/JewishCalendar.swift @@ -885,6 +885,48 @@ public class JewishCalendar { return hebrewCalendar.component(.month, from: workingDate); } + /** + * Returns the Jewish month 1-12 (or 13 years in a leap year) as it is in KosherJava with Nissan being the first month of the year. + * The month count starts with 1 for Nissan and goes to 13 for Adar II + * + * @return the Jewish month from 1 to 12 (or 13 years in a leap year). The month count starts with 1 for Nissan and goes to 13 for Adar II + */ + public func getNissanStartingJewishMonth() -> Int { + var hebrewCalendar = Calendar(identifier: .hebrew) + hebrewCalendar.timeZone = timeZone + let swiftJewishMoth = hebrewCalendar.component(.month, from: workingDate); + switch swiftJewishMoth { + case JewishCalendar.NISSAN: + return 1 + case JewishCalendar.IYAR: + return 2 + case JewishCalendar.SIVAN: + return 3 + case JewishCalendar.TAMMUZ: + return 4 + case JewishCalendar.AV: + return 5 + case JewishCalendar.ELUL: + return 6 + case JewishCalendar.TISHREI: + return 7 + case JewishCalendar.CHESHVAN: + return 8 + case JewishCalendar.KISLEV: + return 9 + case JewishCalendar.TEVES: + return 10 + case JewishCalendar.SHEVAT: + return 11 + case JewishCalendar.ADAR: + return 12 + case JewishCalendar.ADAR_II: + return 13 + default: + return -1 + } + } + /** * Returns the Jewish day of month. *