Skip to content

Commit 8c21c35

Browse files
authored
Merge pull request #30 from Lioydiano/29-impossibile-utilizzare-utenteagenda-durante-il-secondo-periodo-scolastico
29 impossibile utilizzare utenteagenda durante il secondo periodo scolastico
1 parent 47fd224 commit 8c21c35

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
import setuptools
5-
VERSION = "1.2.9"
5+
VERSION = "1.2.10"
66
setuptools.setup(
77
name='Classeviva.py',
88
packages=[

src/classeviva/variabili/variabili.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ def valida_date(*date_: str) -> None:
2424

2525

2626
def anno() -> int:
27-
return datetime.now().year
27+
# Return the academic-year start year:
28+
# if current month >= September, the academic year starts this calendar year,
29+
# otherwise it started the previous calendar year.
30+
now = datetime.now()
31+
return now.year if now.month >= 9 else now.year - 1
2832

2933

3034
def data_inizio_anno() -> str:
@@ -37,6 +41,7 @@ def data_fine_anno() -> str:
3741

3842
def data_fine_anno_o_oggi() -> str:
3943
# Restituisce la data di fine anno scolastico o quella del giorno corrente
40-
if (datetime.now() < datetime(anno(), 6, 30)):
41-
return f"{anno()}{datetime.now().strftime('%m%d')}"
44+
end_of_school = datetime(anno()+1, 6, 30)
45+
if datetime.now() <= end_of_school:
46+
return datetime.now().strftime('%Y%m%d')
4247
return data_fine_anno()

0 commit comments

Comments
 (0)