Skip to content

Commit

Permalink
added a method that gets the jewish month like it is in KosherJava
Browse files Browse the repository at this point in the history
  • Loading branch information
Elyahu41 committed Sep 20, 2024
1 parent 92baef1 commit e97a6f3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion KosherSwiftNew.podspec
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
42 changes: 42 additions & 0 deletions Sources/KosherSwift/hebrewcalendar/JewishCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit e97a6f3

Please sign in to comment.