diff --git a/package.json b/package.json index ba0290c..abffb56 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ }, "dependencies": { "moment-jalaali": "^0.7.4", + "pholiday": "^0.2.1", "prop-types": "^15.7.2", "react-native-common": "^1.8.2", "uuid": "3.2.1" diff --git a/src/Day.js b/src/Day.js index d425d11..a846cd9 100644 --- a/src/Day.js +++ b/src/Day.js @@ -11,6 +11,7 @@ const React = require('react'); const PropTypes = require('prop-types'); const jMoment = require('moment-jalaali'); const { Text, TouchableOpacity, View } = require('react-native'); +const pholiday = require('pholiday'); function Day(props) { const { @@ -227,11 +228,24 @@ function Day(props) { } } + const isHoliday = pholiday( + `${year}/${Number(month) + 1}/${day}`, + 'jYYYY/jM/jD', + ) + .events() + .find(event => event.isHoliday); + const holidayStyle = isHoliday ? { backgroundColor: 'red' } : {}; + return ( onPressDay(day)} >