A widget that calculates and displays prayer times, dates of fasts and holidays, and the weekly torah portion, according to halakha (Jewish Law). This plugin started as a rewrite and extension of the Daily Zman Widget by Adato Systems
The plugin works by pulling the user's location, via HTML5 Geolocation or ipapi. From there it plugs the user's longitude and latitude into the Google Maps Geocoding API and generates the corresponding city, state, and country. It then calculates the current UTC time for the user's location, and plugs it into the SunCalc Library, and performs sunrise and sunset-based calculations, in order to generate the relevant halakhic times for daily prayer, Shabbat, and Habdala.
The following libraries and APIs are used in this plugin:
- HTML5 Geolocation API
- Google Maps Geocoding API
- Google Maps Time Zone API
- SunCalc Library
- jQuery
- ipapi
- Increase wp-admin options for customization
- Write JS tests
ashkiToSeph: DRY, Holiday functionality needs implementation- Possible: Asbtract date checking from
getCandlesAndHebDate,getPerasha, andgetHabdalaTimes formatTimeseems like it's doing the opposite of what it's supposed- Possible: combine the two Minha calculation functions.
- DRY is good, but current naming structure may be better
- Replace
jQuery(document).ready(function($)with vanilla Javascript
- Combined
getCandleTimes()andgetHebDate()into singlegetCandlesAndHebDate()function ashkiToSeph- fixed holiday conversion codehebCalShab()- replaced deprecatedDate.GetYear()withDate.GetFullYear()- Removed redundant variables and functions
- Replaced vars with const and let
- Cleaned up arrow functions
- Tidy up code alignment
- Replace
forEachstatements withfilterstatements where possible
- Added Docblocks to all JS functions
- Fix bug in
ashkiToSeph()function, and other related parsing issues.
Consolidates and removes redundant functions. Improves code logic.
Removed Functions:
hebCalWeekday()was consolidated intohebCalShabbatgenerateDateStrings()displayShabbatTimes()consolidated into displayTimes()
Renamed Functions:
generateDatesWithHebcal()is nowgeneratePreDates()calculateTimesis nowcalculateSunTimes()
Modified Functions:
timesHelper()- moved thedisplayTimes()call to parent function- calculateTimes() - deprecated the Shabbat-specific calculations (which are now handled via Hebcal API).
Other:
perashaHebnow outputsפרשהinstead ofפרשת- Cleaned up unnecessary comments and
console.logstatements - Replaced additional double quotes surrounding strings, with single quotes
-
Removed Functions:
hebCalWeekday()consolidated into hebCalShabbatgenerateDateStrings()was deprecated and unuseddisplayShabbatTimes()consolidated into displayTimes()
-
Modified Functions:
generateDatesWithHebcal()renamed togeneratePreDates()- Removed inner return statements (in forEach section) from getCandleTimes, getHebDate, getPerasha, and getHabdalaTimes et al.
timesHelper()- moveddisplayTimes()call to parent functioncalculateTimes()- removed Shabbat calculations (since they're now done with hebCal)calculateTimes()renamed tocalculateSunTimes()
-
Logic:
- Improved code logic: moved call for
displayTimes()fromtimesHelper()tohebCalShab()
- Improved code logic: moved call for
-
Front-End:
- Corrected perashaHeb output (removed the tav from the end of perasha)
-
Code Quality:
- Removed unnecessary "Issues" section above the widget class
- Removed some unnecessary
console.log's - Replaced double quotes with single quotes, wherever possible
-
Need to:
- DRY for candles, hebdate, habdala, perasha
- Display holidays when a holiday is upcoming.
- Rewrote the Hebcal parsing logic to be more intelligent
- New functions:
- getShabbatDate()
- getCandleTimes()
- getHebDate()
- getPerasha()
- getHabdalaTimes()
- ashkiToSeph() - added holiday list, and updated parsing logic to reflect Hebcal's API.
- Renamed hebcalHol to hebCalWeekday
- Added padding to outputted text
- Removed Deprecated getLatLongByAddr()
- Code Quality:
- Replace double quotes surrounding strings, with single quotes
- Use dot notation, instead of bracket for js arrays
- Utilize obj.forEach for better parsing of js arrays.
- Generating zemannim by IP + hebcal API working.
- Add docblocks and clean up code.
- Deprecate getLatLongByAddr()
- Deprecate abbrRegion()
- Fix bug with getting user address via IP
- Switched from IP-DB to ipapi
- Combine Shabbath and Weekday times into single widget
- N/A