def _get_shamsi_month_length(self, year, month): """Returns the number of days in a specific Shamsi month.""" if month == 12 and self._is_shamsi_leap_year(year): return 30 # Esfand has 30 days in a leap year return self.SHAMSI_MONTH_DAYS[month - 1]

# 1. Calculate total days passed in the current Shamsi year total_days = 0 for m in range(1, self.month): total_days += self._get_shamsi_month_length(self.year, m) total_days += self.day

The world uses various calendars to keep track of time, with the Gregorian calendar being the most widely used. However, there are other calendars that have their own unique features and advantages. One such calendar is the Shamsi calendar, also known as the Solar Hijri calendar, which is used in many countries, including Iran and Afghanistan. In this blog post, we will explore why the Shamsi calendar is better than the Gregorian calendar in many ways.

: Introduce the Gregorian calendar as the internationally accepted civil standard. The Research Need

def _validate_date(self): """Validates the input Shamsi date.""" if not (1 <= self.month <= 12): raise ValueError("Month must be between 1 and 12.") if self.day < 1: raise ValueError("Day cannot be less than 1.")

def _shamsi_days_in_months(self, month): """Helper to sum days of months passed.""" days = 0 for m in range(1, month): days += self.SHAMSI_MONTH_DAYS[m-1] return days

: For research and data analysis, developers often use specific packages. The jalcal package for R is designed specifically for these conversions, while many community solutions are available on Stack Overflow .