Skip to content

Commit 2c7c393

Browse files
♻️ refactor(calendar.all): Do not depend on timezone.current.
1 parent 8164649 commit 2c7c393

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

.bin/calendar._all

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
#!/usr/bin/env python3
22

3-
from zoneinfo import ZoneInfo
43
from datetime import datetime, timedelta
54
import re
6-
import subprocess
75

8-
TZ = subprocess.check_output(['timezone.current']).decode().strip()
96
FMT = '%Y-%m-%d %H:%M:%S'
107
REGEX_URL = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(), ]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
118
EXCLUDED_URLS = [
@@ -50,7 +47,7 @@ def _add_months(dt: datetime, months: int) -> datetime:
5047
month = total_month % 12 + 1
5148
return dt.replace(year=year, month=month)
5249

53-
now = datetime.now(ZoneInfo(TZ))
50+
now = datetime.now().astimezone()
5451
today = now.replace(hour=0, minute=0, second=0, microsecond=0)
5552
tomorrow = today + timedelta(days=1)
5653
dayaftertomorrow = tomorrow + timedelta(days=1)

0 commit comments

Comments
 (0)