[packages/python-umalqurra] - new; with git patches and fix for 29-30th day of 2nd hijri month

qboosh qboosh at pld-linux.org
Tue Jul 15 18:11:18 CEST 2025


commit 59a6aa124b26440362175857cdc110acff39bbb1
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jul 15 18:12:46 2025 +0200

    - new; with git patches and fix for 29-30th day of 2nd hijri month

 python-hijiri-ummalqura-git.patch | 464 ++++++++++++++++++++++++++++++++++++++
 python-umalqurra.spec             | 128 +++++++++++
 umalqurra-hijri-date.patch        |  12 +
 umalqurra-missing.patch           |  63 ++++++
 4 files changed, 667 insertions(+)
---
diff --git a/python-umalqurra.spec b/python-umalqurra.spec
new file mode 100644
index 0000000..dfe1706
--- /dev/null
+++ b/python-umalqurra.spec
@@ -0,0 +1,128 @@
+#
+# Conditional build:
+%bcond_without	doc	# Sphinx documentation
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+Summary:	Date API that support Hijri Umalqurra calendar
+Summary(pl.UTF-8):	Funkcje dat obsługujące kalendarz muzułmański (hidżry)
+Name:		python-umalqurra
+Version:	0.2
+Release:	2
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/umalqurra/
+Source0:	https://files.pythonhosted.org/packages/source/u/umalqurra/umalqurra-%{version}.tar.gz
+# Source0-md5:	3b9ed27f31782db8c716585ca76a1457
+# https://github.com/tytkal/python-hijiri-ummalqura/raw/29f33de93738a069f1cdb20bc7f420f16303b852/README.md
+Patch0:		umalqurra-missing.patch
+# most commits from https://github.com/tytkal/python-hijiri-ummalqura/commits/master/
+# (without dist and pip files, conflicting setup.py disabled)
+Patch1:		python-hijiri-ummalqura-git.patch
+Patch2:		umalqurra-hijri-date.patch
+URL:		https://pypi.org/project/umalqurra/
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.5
+BuildRequires:	python-setuptools
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules >= 1:3.2
+BuildRequires:	python3-setuptools
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python-modules >= 1:2.5
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Date API that support Hijri Umalqurra calendar. Features:
+- Convert Gregorian to Hijri
+- Convert Hijri to Gregorian
+- give the Arabic name of the Hijri month
+- give the English name of the Gregorian month
+- give the day name in Arabic and English
+- give the current day both in Hijri and Gregorian
+
+%description -l pl.UTF-8
+Funkcje dla dat obsługujące kalendarz muzułmański (hidżry).
+Funkcjonalność:
+- konwersja z kalendarza gregoriańskiego do hidżry
+- konwersja z hidżry do kalendarza gregoriańskiego
+- arabska nazwa miesiąca hidżry
+- angielska nazwa miesiąca gregoriańskiego
+- nazwa dnia arabska i angielska
+- bieżący dzień w kalendarzu hidżry i gregoriańskim
+
+%package -n python3-umalqurra
+Summary:	Date API that support Hijri Umalqurra calendar
+Summary(pl.UTF-8):	Funkcje dat obsługujące kalendarz muzułmański (hidżry)
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.2
+
+%description -n python3-umalqurra
+Date API that support Hijri Umalqurra calendar. Features:
+- Convert Gregorian to Hijri
+- Convert Hijri to Gregorian
+- give the Arabic name of the Hijri month
+- give the English name of the Gregorian month
+- give the day name in Arabic and English
+- give the current day both in Hijri and Gregorian
+
+%description -n python3-umalqurra -l pl.UTF-8
+Funkcje dla dat obsługujące kalendarz muzułmański (hidżry).
+Funkcjonalność:
+- konwersja z kalendarza gregoriańskiego do hidżry
+- konwersja z hidżry do kalendarza gregoriańskiego
+- arabska nazwa miesiąca hidżry
+- angielska nazwa miesiąca gregoriańskiego
+- nazwa dnia arabska i angielska
+- bieżący dzień w kalendarzu hidżry i gregoriańskim
+
+%prep
+%setup -q -n umalqurra-%{version}
+%patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+
+%build
+%if %{with python2}
+%py_build
+%endif
+
+%if %{with python3}
+%py3_build
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{py_sitescriptdir}/umalqurra
+%{py_sitescriptdir}/umalqurra-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-umalqurra
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{py3_sitescriptdir}/umalqurra
+%{py3_sitescriptdir}/umalqurra-%{version}-py*.egg-info
+%endif
diff --git a/python-hijiri-ummalqura-git.patch b/python-hijiri-ummalqura-git.patch
new file mode 100644
index 0000000..01e67c0
--- /dev/null
+++ b/python-hijiri-ummalqura-git.patch
@@ -0,0 +1,464 @@
+From ed05c45a91576f29e9d39f79163178e263f22734 Mon Sep 17 00:00:00 2001
+From: Dauren <dauren.chapaev at ce.sdu.edu.kz>
+Date: Sat, 17 Oct 2015 13:03:53 +0600
+Subject: [PATCH] attribute/month_len
+
+---
+ .gitignore              | 2 ++
+ umalqurra/hijri.py      | 5 +++--
+ umalqurra/hijri_date.py | 6 ++++--
+ 3 files changed, 9 insertions(+), 4 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..2f78cf5
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,2 @@
++*.pyc
++
+diff --git a/umalqurra/hijri.py b/umalqurra/hijri.py
+index 796d52d..20f95db 100644
+--- a/umalqurra/hijri.py
++++ b/umalqurra/hijri.py
+@@ -3,7 +3,7 @@
+ '''
+ This class is responsoble to convert from Hijri to Gregorian or from Gregorian to Hijri
+ The algrothem was converted  from java script to python by Khalid Al-hussayen in 1436-3-14 2015-1-5
+-The orjinal source developed by Suhail Alkowaileet the source url https://github.com/xsoh/Hijri.js/blob/master/Hijri.js 
++The orjinal source developed by Suhail Alkowaileet the source url https://github.com/xsoh/Hijri.js/blob/master/Hijri.js
+ '''
+ 
+ class Umalqurra:
+@@ -34,7 +34,8 @@ def gegorean_to_hijri(self, year, month, day):
+         iy = ii + 1
+         im = iln - 12 * ii
+         id = mcjdn - UmalqurraArray.ummalqura_dat[index - 1] + 1
+-        return iy, im, id
++        ml = UmalqurraArray.ummalqura_dat[index] - UmalqurraArray.ummalqura_dat[index - 1]
++        return iy, im, id, ml
+ 
+     def hijri_to_gregorian(self, year, month, day):
+         year = int(year)
+diff --git a/umalqurra/hijri_date.py b/umalqurra/hijri_date.py
+index 8b9c4a6..02c3473 100644
+--- a/umalqurra/hijri_date.py
++++ b/umalqurra/hijri_date.py
+@@ -14,6 +14,8 @@ class HijriDate:
+     day = -1
+     #month in hijri
+     month = -1
++    #month len
++    month_len = -1
+     #year in hijri
+     year = -1
+     day_gr = -1
+@@ -39,7 +41,7 @@ def __init__(self,year=None,month=None,day=None,gr=False):
+     def set_date_from_gr(self,year,month,day):
+         um = Umalqurra()
+         self.day_gr, self.month_gr, self.year_gr = day, month, year
+-        self.year, self.month, self.day = um.gegorean_to_hijri(year,month,day)
++        self.year, self.month, self.day, self.month_len = um.gegorean_to_hijri(year,month,day)
+         self.month_name = self.month_dict[self.month]
+         date_gr = date(year,month,day)
+         self.day_name_en = date_gr.strftime("%A")
+@@ -60,4 +62,4 @@ def set_date(self,year,month,day):
+     def today(cls):
+         today = date.today()
+         hijri_date = HijriDate(today.year,today.month,today.day,True)
+-        return hijri_date
+\ No newline at end of file
++        return hijri_date
+From f4b55d836c661a11e0e73891b5f92cd5691aad92 Mon Sep 17 00:00:00 2001
+From: angru <angru at list.ru>
+Date: Fri, 19 Feb 2016 09:21:06 +0300
+Subject: [PATCH] Using explicit relative imports instead of absolute imports
+ to Py3 support
+
+---
+ umalqurra/hijri.py      | 2 +-
+ umalqurra/hijri_date.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/umalqurra/hijri.py b/umalqurra/hijri.py
+index 20f95db..ef941bb 100644
+--- a/umalqurra/hijri.py
++++ b/umalqurra/hijri.py
+@@ -1,5 +1,5 @@
+ import math
+-from ummalqura_arrray import UmalqurraArray
++from .ummalqura_arrray import UmalqurraArray
+ '''
+ This class is responsoble to convert from Hijri to Gregorian or from Gregorian to Hijri
+ The algrothem was converted  from java script to python by Khalid Al-hussayen in 1436-3-14 2015-1-5
+diff --git a/umalqurra/hijri_date.py b/umalqurra/hijri_date.py
+index 02c3473..a3eefe9 100644
+--- a/umalqurra/hijri_date.py
++++ b/umalqurra/hijri_date.py
+@@ -7,7 +7,7 @@
+ You can query for the current day in both Hijri and Gregorian
+ '''
+ __author__ = 'Khalid'
+-from hijri import Umalqurra
++from .hijri import Umalqurra
+ from datetime import date
+ class HijriDate:
+     #day in hijri
+From b9795e49a4b6ba5dbc5134c693319116c32582eb Mon Sep 17 00:00:00 2001
+From: khalid <tytkal at gmail.com>
+Date: Sun, 4 Feb 2018 09:39:53 +0300
+Subject: [PATCH] Update README.md
+
+---
+ README.md | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/README.md b/README.md
+index e7d7c71..7a82d20 100644
+--- a/README.md
++++ b/README.md
+@@ -58,3 +58,11 @@ um.day
+ The Hijri algorthem code has been transulate from javascript to python.
+ The java script was developed by Suhail Alkowaileet https://github.com/xsoh/Hijri.js/blob/master/Hijri.js
+ also I use this code for more understanding https://github.com/kbwood/calendars/blob/master/jquery.calendars.ummalqura.js
++
++License
++-------
++
++MIT
++
++[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
++[license-url]: LICENSE
+From e06f16fb771b1e3b5c42c43dc17a92c85f39d8b0 Mon Sep 17 00:00:00 2001
+From: Tanbir Hasan <tanbir2025 at gmail.com>
+Date: Thu, 22 Feb 2018 01:47:32 +0600
+Subject: [PATCH 1/2] update hijri.py
+
+---
+ umalqurra/hijri.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/umalqurra/hijri.py b/umalqurra/hijri.py
+index ef941bb..6413053 100644
+--- a/umalqurra/hijri.py
++++ b/umalqurra/hijri.py
+@@ -1,5 +1,5 @@
+ import math
+-from .ummalqura_arrray import UmalqurraArray
++from umalqurra.ummalqura_arrray import UmalqurraArray
+ '''
+ This class is responsoble to convert from Hijri to Gregorian or from Gregorian to Hijri
+ The algrothem was converted  from java script to python by Khalid Al-hussayen in 1436-3-14 2015-1-5
+
+From dcc33cf7e29570dbbbc11656c785794c084bd688 Mon Sep 17 00:00:00 2001
+From: Tanbir Hasan <tanbir2025 at gmail.com>
+Date: Thu, 22 Feb 2018 01:48:35 +0600
+Subject: [PATCH 2/2] update hijri_date.py
+
+---
+ umalqurra/hijri_date.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/umalqurra/hijri_date.py b/umalqurra/hijri_date.py
+index a3eefe9..2c534c3 100644
+--- a/umalqurra/hijri_date.py
++++ b/umalqurra/hijri_date.py
+@@ -7,7 +7,7 @@
+ You can query for the current day in both Hijri and Gregorian
+ '''
+ __author__ = 'Khalid'
+-from .hijri import Umalqurra
++from umalqurra.hijri import Umalqurra
+ from datetime import date
+ class HijriDate:
+     #day in hijri
+From a849487cadd84d822682c7d1a25fe1cbb869020f Mon Sep 17 00:00:00 2001
+From: sigmaSd <bedisnbiba at gmail.com>
+Date: Tue, 31 Jul 2018 19:57:42 +0100
+Subject: [PATCH] Quick Styling :)
+
+---
+ README.md | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/README.md b/README.md
+index 7a82d20..cee072f 100644
+--- a/README.md
++++ b/README.md
+@@ -1,13 +1,13 @@
+-#Python Hijri Umalqurra
+-##Introduction
++# Python Hijri Umalqurra
++## Introduction
+ Python Umalqurra Calender is an API that will give you the ability to convert Gregorian to Hijri and hijri to Gregorian
+ it will give you the day name in arabic and english , and the month name in Hijri arabic and Gregorian.
+-##Install
++## Install
+ You can install the library through pip 
+ ```sh
+ pip install umalqurra
+ ```
+-##Usage
++## Usage
+ you can run the code in the python interpreter to see the result 
+ ```py
+ from umalqurra.hijri_date import HijriDate
+@@ -54,7 +54,7 @@ if you want the current day
+ um = HijriDate.today()
+ um.day
+ ```
+-##Reference
++## Reference
+ The Hijri algorthem code has been transulate from javascript to python.
+ The java script was developed by Suhail Alkowaileet https://github.com/xsoh/Hijri.js/blob/master/Hijri.js
+ also I use this code for more understanding https://github.com/kbwood/calendars/blob/master/jquery.calendars.ummalqura.js
+From 8439ec38446127164d4df73e1bc40a77bd14df19 Mon Sep 17 00:00:00 2001
+From: stiko <hamada.alsamrai at gmail.com>
+Date: Fri, 9 Nov 2018 02:02:13 -0500
+Subject: [PATCH 1/6] Add license
+
+---
+ LICENSE | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+ create mode 100644 LICENSE
+
+diff --git a/LICENSE b/LICENSE
+new file mode 100644
+index 0000000..335ea9d
+--- /dev/null
++++ b/LICENSE
+@@ -0,0 +1,19 @@
++Copyright (c) 2018 The Python Packaging Authority
++
++Permission is hereby granted, free of charge, to any person obtaining a copy
++of this software and associated documentation files (the "Software"), to deal
++in the Software without restriction, including without limitation the rights
++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++copies of the Software, and to permit persons to whom the Software is
++furnished to do so, subject to the following conditions:
++
++The above copyright notice and this permission notice shall be included in all
++copies or substantial portions of the Software.
++
++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++SOFTWARE.
+\ No newline at end of file
+
+#From 83d2c2eda8e6202b7f127bfed130f7963cac54fd Mon Sep 17 00:00:00 2001
+#From: stiko <hamada.alsamrai at gmail.com>
+#Date: Fri, 9 Nov 2018 02:02:28 -0500
+#Subject: [PATCH 2/6] Add readme
+#
+#---
+# setup.py | 21 +++++++++++++++++++++
+# 1 file changed, 21 insertions(+)
+# create mode 100644 setup.py
+#
+#diff --git a/setup.py b/setup.py
+#new file mode 100644
+#index 0000000..7ff8409
+#--- /dev/null
+#+++ b/setup.py
+#@@ -0,0 +1,21 @@
+#+import setuptools
+#+
+#+with open("README.md", "r") as fh:
+#+    long_description = fh.read()
+#+
+#+setuptools.setup(
+#+    name="umalqurra",
+#+    version="1.0.0",
+#+    author="tytkal",
+#+    author_email="tytkal at gmail.com",
+#+    description="Islamic calendar (hijri).",
+#+    long_description=long_description,
+#+    long_description_content_type="text/markdown",
+#+    url="https://github.com/tytkal/python-hijiri-ummalqura",
+#+    packages=setuptools.find_packages(),
+#+    classifiers=[
+#+        "Programming Language :: Python :: 3",
+#+        "License :: OSI Approved :: MIT License",
+#+        "Operating System :: OS Independent",
+#+    ],
+#+)
+#\ No newline at end of file
+
+From 706801291a0281e5de79c8afc1e8b2d534d84e2b Mon Sep 17 00:00:00 2001
+From: stiko <hamada.alsamrai at gmail.com>
+Date: Fri, 9 Nov 2018 02:05:21 -0500
+Subject: [PATCH 3/6] Cleanup and remove unnecessary semicolon
+
+---
+ umalqurra/hijri.py | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/umalqurra/hijri.py b/umalqurra/hijri.py
+index 6413053..2a1e457 100644
+--- a/umalqurra/hijri.py
++++ b/umalqurra/hijri.py
+@@ -1,14 +1,17 @@
+ import math
+ from umalqurra.ummalqura_arrray import UmalqurraArray
++
+ '''
+ This class is responsoble to convert from Hijri to Gregorian or from Gregorian to Hijri
+ The algrothem was converted  from java script to python by Khalid Al-hussayen in 1436-3-14 2015-1-5
+ The orjinal source developed by Suhail Alkowaileet the source url https://github.com/xsoh/Hijri.js/blob/master/Hijri.js
+ '''
+ 
++
+ class Umalqurra:
+     def gegorean_to_hijri(self, year, month, day):
+-        # This code the modified version of R.H. van Gent Code, it can be found at http://www.staff.science.uu.nl/~gent0113/islam/ummalqura.htm
++        # This code the modified version of R.H. van Gent Code, it can be found
++        # at http://www.staff.science.uu.nl/~gent0113/islam/ummalqura.htm
+         # read calendar data
+         day = int(day)
+         m = int(month)  # Here we enter the Index of the month (which starts with Zero)
+@@ -26,7 +29,7 @@ def gegorean_to_hijri(self, year, month, day):
+         a = math.floor((cjdn - 1867216.25) / 36524.25)
+         # compute Modified Chronological Julian Day Number (MCJDN)
+         mcjdn = cjdn - 2400000
+-        #the MCJDN's of the start of the lunations in the Umm al-Qura calendar are stored in 'islamcalendar_dat.js'
++        # the MCJDN's of the start of the lunations in the Umm al-Qura calendar are stored in 'islamcalendar_dat.js'
+         index = UmalqurraArray.get_index(mcjdn)
+         # compute and output the Umm al-Qura calendar date
+         iln = index + 16260
+@@ -49,15 +52,14 @@ def hijri_to_gregorian(self, year, month, day):
+         i = iln - 16260
+         mcjdn = id + UmalqurraArray.ummalqura_dat[i - 1] - 1
+         cjdn = mcjdn + 2400000
+-        return self.julianToGregorian(cjdn);
+-
++        return self.julian_to_gregorian(cjdn)
+ 
+-    def julianToGregorian(self,julianDate):
++    def julian_to_gregorian(self, julianDate):
+         # source from: http://keith-wood.name/calendars.html
+         z = math.floor(julianDate + 0.5)
+         a = math.floor((z - 1867216.25) / 36524.25)
+         a = z + 1 + a - math.floor(a / 4)
+-        b = a + 1524;
++        b = a + 1524
+         c = math.floor((b - 122.1) / 365.25)
+         d = math.floor(365.25 * c)
+         e = math.floor((b - d) / 30.6001)
+@@ -72,4 +74,4 @@ def julianToGregorian(self,julianDate):
+             year = c - 4715
+         if year <= 0:
+             year -= 1
+-        return year, month , day
++        return year, month, day
+
+From 76495118a5a165ed7ca915cac92bfff422ad5c75 Mon Sep 17 00:00:00 2001
+From: stiko <hamada.alsamrai at gmail.com>
+Date: Fri, 9 Nov 2018 02:05:56 -0500
+Subject: [PATCH 4/6] Fix date range
+
+---
+ umalqurra/hijri_date.py | 58 ++++++++++++++++++++++++-----------------
+ 1 file changed, 34 insertions(+), 24 deletions(-)
+
+diff --git a/umalqurra/hijri_date.py b/umalqurra/hijri_date.py
+index 2c534c3..f3fc3af 100644
+--- a/umalqurra/hijri_date.py
++++ b/umalqurra/hijri_date.py
+@@ -9,51 +9,61 @@
+ __author__ = 'Khalid'
+ from umalqurra.hijri import Umalqurra
+ from datetime import date
++import datetime
++
++
+ class HijriDate:
+-    #day in hijri
++    # day in hijri
+     day = -1
+-    #month in hijri
++    # month in hijri
+     month = -1
+-    #month len
++    # month len
+     month_len = -1
+-    #year in hijri
++    # year in hijri
+     year = -1
+     day_gr = -1
+     month_gr = -1
+     year_gr = -1
+-    #day bane in arabic
++    # day bane in arabic
+     day_name = ''
+-    #month name in hijri
++    # month name in hijri
+     month_name = ''
+-    month_dict = {1:'محرم',2:'صفر',3:'ربيع الأول',4:'ربيع الثاني',5:'جمادي الأولى',6:'جمادي الآخرة',7:'رجب'
+-    ,8:'شعبان',9:'رمضان',10:'شوال',11:'ذو القعدة',12:'ذو الحجة'}
+-    day_dict = {'Saturday':'السبت','Sunday':'الاحد','Monday':'الاثنين','Tuesday':'الثلاثاء',
+-                'Wednesday':'الاربعاء','Thursday':'الخميس','Friday':'الجمعة'}
++    month_dict = {1: 'محرم', 2: 'صفر', 3: 'ربيع الأول', 4: 'ربيع الثاني', 5: 'جمادي الأولى', 6: 'جمادي الآخرة', 7: 'رجب'
++        , 8: 'شعبان', 9: 'رمضان', 10: 'شوال', 11: 'ذو القعدة', 12: 'ذو الحجة'}
++    day_dict = {'Saturday': 'السبت', 'Sunday': 'الاحد', 'Monday': 'الاثنين', 'Tuesday': 'الثلاثاء',
++                'Wednesday': 'الاربعاء', 'Thursday': 'الخميس', 'Friday': 'الجمعة'}
+     month_name_gr = ''
+     day_name_en = ''
+-    def __init__(self,year=None,month=None,day=None,gr=False):
+-        if year != None and month != None and day != None:
+-            if gr == False:
+-                self.set_date(year,month,day)
++
++    def __init__(self, year=None, month=None, day=None, gr=False):
++        if year is not None and month is not None and day is not None:
++            if not gr:
++                self.set_date(year, month, day)
+             else:
+-                self.set_date_from_gr(year,month,day)
+-    #Set dates if the date send by user is Gregorian
+-    def set_date_from_gr(self,year,month,day):
++                self.set_date_from_gr(year, month, day)
++
++    # Set dates if the date send by user is Gregorian
++    def set_date_from_gr(self, year, month, day):
++        # This will kick an error if month or day out of range
++        datetime.datetime(year, month, day)
+         um = Umalqurra()
+         self.day_gr, self.month_gr, self.year_gr = day, month, year
+-        self.year, self.month, self.day, self.month_len = um.gegorean_to_hijri(year,month,day)
++        self.year, self.month, self.day, self.month_len = um.gegorean_to_hijri(year, month, day)
+         self.month_name = self.month_dict[self.month]
+-        date_gr = date(year,month,day)
++        date_gr = date(year, month, day)
+         self.day_name_en = date_gr.strftime("%A")
+         self.day_name = self.day_dict[self.day_name_en]
+         self.month_name_gr = date_gr.strftime("%B")
+-    #Set dates if date send by user is Hijri
+-    def set_date(self,year,month,day):
++
++    # Set dates if date send by user is Hijri
++    def set_date(self, year, month, day):
++        # This will kick an error if month or day out of range
++        datetime.datetime(year, month, day)
+         um = Umalqurra()
+         self.day, self.month, self.year = day, month, year
+         self.month_name = self.month_dict[month]
+-        self.year_gr, self.month_gr, self.day_gr = um.hijri_to_gregorian(year,month,day)
+-        date_gr = date(int(self.year_gr),int(self.month_gr),int(self.day_gr))
++        self.year_gr, self.month_gr, self.day_gr = um.hijri_to_gregorian(year, month, day)
++        date_gr = date(int(self.year_gr), int(self.month_gr), int(self.day_gr))
+         self.day_name_en = date_gr.strftime("%A")
+         self.day_name = self.day_dict[self.day_name_en]
+         self.month_name_gr = date_gr.strftime("%B")
+@@ -61,5 +71,5 @@ def set_date(self,year,month,day):
+     @classmethod
+     def today(cls):
+         today = date.today()
+-        hijri_date = HijriDate(today.year,today.month,today.day,True)
++        hijri_date = HijriDate(today.year, today.month, today.day, True)
+         return hijri_date
+
diff --git a/umalqurra-hijri-date.patch b/umalqurra-hijri-date.patch
new file mode 100644
index 0000000..86d3a41
--- /dev/null
+++ b/umalqurra-hijri-date.patch
@@ -0,0 +1,12 @@
+Hijri months have 29 or 30 days, also for month=2, which is not valid in Georgian calendar
+--- umalqurra-0.2/umalqurra/hijri_date.py.orig	2025-07-15 17:52:56.608078010 +0200
++++ umalqurra-0.2/umalqurra/hijri_date.py	2025-07-15 17:53:13.957984018 +0200
+@@ -57,8 +57,6 @@ class HijriDate:
+ 
+     # Set dates if date send by user is Hijri
+     def set_date(self, year, month, day):
+-        # This will kick an error if month or day out of range
+-        datetime.datetime(year, month, day)
+         um = Umalqurra()
+         self.day, self.month, self.year = day, month, year
+         self.month_name = self.month_dict[month]
diff --git a/umalqurra-missing.patch b/umalqurra-missing.patch
new file mode 100644
index 0000000..9407d7a
--- /dev/null
+++ b/umalqurra-missing.patch
@@ -0,0 +1,63 @@
+--- umalqurra-0.2/README.md.orig	1970-01-01 01:00:00.000000000 +0100
++++ umalqurra-0.2/README.md	1970-01-01 01:00:00.000000000 +0100
+@@ -0,0 +1,60 @@
++#Python Hijri Umalqurra
++##Introduction
++Python Umalqurra Calender is an API that will give you the ability to convert Gregorian to Hijri and hijri to Gregorian
++it will give you the day name in arabic and english , and the month name in Hijri arabic and Gregorian.
++##Install
++You can install the library through pip 
++```sh
++pip install umalqurra
++```
++##Usage
++you can run the code in the python interpreter to see the result 
++```py
++from umalqurra.hijri_date import HijriDate
++#create the object with Gregorian date 
++um = HijriDate(1989,1,10,gr=True)
++#to see the day in Hijri
++um.day # result : 3.0
++#to see the month in Hijri
++um.month #result is 6.0
++#year
++um.year #1409
++#day name in arabic
++print um.day_name #الثلاثاء
++#day in english
++um.day_name_en #Tuesday
++#month in Hijri Arabic
++print um.month_name #جمادي الاخرة
++#month in Gregorian English
++um.month_name_gr #January
++#year in Gregorian
++um.year_gr #1989
++#month in Gregorian
++um.month_gr # 1
++#day in Gregorian
++um.day_gr # 10
++```
++if you want to convert from Hijri to Gregorian just change the parameter in the constructor and don't pass flag 'gr'
++```py
++#create the object with Hijri date 
++um = HijriDate(1436,3,15)
++```
++if you want to set the Hijri date from method not constructor
++```py
++um = HijriDate()
++um.set_date(1409,6,3)
++```
++if you want to set the Gregorian date from method not constructor
++```py
++um = HijriDate()
++um.set_date_from_gr(2015,1,6)
++```
++if you want the current day 
++```py
++um = HijriDate.today()
++um.day
++```
++##Reference
++The Hijri algorthem code has been transulate from javascript to python.
++The java script was developed by Suhail Alkowaileet https://github.com/xsoh/Hijri.js/blob/master/Hijri.js
++also I use this code for more understanding https://github.com/kbwood/calendars/blob/master/jquery.calendars.ummalqura.js
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-umalqurra.git/commitdiff/59a6aa124b26440362175857cdc110acff39bbb1



More information about the pld-cvs-commit mailing list