Skip to content

Commit ea85dd0

Browse files
committed
delete get_timezone_txt
1 parent 175888d commit ea85dd0

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

appointment/utils/view_helpers.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,3 @@ def generate_random_id() -> str:
3939
:return: The randomly generated UUID as a hex string
4040
"""
4141
return uuid.uuid4().hex
42-
43-
44-
def get_timezone_txt() -> str:
45-
# TODO: To be better implemented in the future
46-
"""Get the current timezone as a string. To be used in the HTML template when the user is choosing the appointment's
47-
time.
48-
49-
:return: The current timezone in a string format.
50-
"""
51-
tmz = settings.TIME_ZONE
52-
timezone_map = {
53-
'UTC': 'Universal Time Coordinated (UTC)',
54-
'US/Eastern': 'Eastern Daylight Time (US & Canada)',
55-
'US/Central': 'Central Time (US & Canada)',
56-
'US/Mountain': 'Mountain Time (US & Canada)',
57-
'US/Pacific': 'Pacific Time (US & Canada)',
58-
'US/Alaska': 'Alaska Time (US & Canada)',
59-
'US/Hawaii': 'Hawaii Time (US & Canada)',
60-
'Europe/Paris': 'Paris Time (Europe)',
61-
'Europe/London': 'London Time (Europe)',
62-
'EDT': 'Eastern Daylight Time (US & Canada)',
63-
}
64-
return timezone_map.get(tmz, 'Universal Time Coordinated (UTC)')

appointment/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from django.urls import reverse
2020
from django.utils.encoding import force_str
2121
from django.utils.http import urlsafe_base64_decode
22+
from django.utils.timezone import get_current_timezone_name
2223
from django.utils.translation import gettext as _
2324

2425
from appointment.forms import AppointmentForm, AppointmentRequestForm
@@ -38,7 +39,7 @@
3839
send_reschedule_confirmation_email, \
3940
send_thank_you_email
4041
from appointment.utils.session import get_appointment_data_from_session, handle_existing_email
41-
from appointment.utils.view_helpers import get_locale, get_timezone_txt
42+
from appointment.utils.view_helpers import get_locale
4243
from .decorators import require_ajax
4344
from .messages_ import passwd_error, passwd_set_successfully
4445
from .services import get_appointments_and_slots, get_available_slots_for_staff
@@ -219,7 +220,7 @@ def appointment_request(request, service_id=None, staff_member_id=None):
219220
'available_slots': available_slots,
220221
'date_chosen': date_chosen,
221222
'locale': get_locale(),
222-
'timezoneTxt': get_timezone_txt(),
223+
'timezoneTxt': get_current_timezone_name(),
223224
'label': label
224225
}
225226
context = get_generic_context_with_extra(request, extra_context, admin=False)
@@ -527,7 +528,7 @@ def prepare_reschedule_appointment(request, id_request):
527528
'available_slots': available_slots,
528529
'date_chosen': date_chosen,
529530
'locale': get_locale(),
530-
'timezoneTxt': get_timezone_txt(),
531+
'timezoneTxt': get_current_timezone_name(),
531532
'label': label,
532533
'rescheduled_date': ar.date.strftime("%Y-%m-%d"),
533534
'page_header': page_title,

docs/utils/view_helpers.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,3 @@ This module provides utility functions to support the Django views in the appoin
3333

3434
- **generate_random_id()**:
3535
- Produces a random UUID in the form of a hexadecimal string.
36-
37-
### Timezone Operations:
38-
39-
- **get_timezone_txt()**:
40-
- Retrieve the current timezone as a string, suitable for display purposes in the HTML templates when users choose
41-
the appointment time.
42-
- Note: The function implementation may be enhanced in the future.

0 commit comments

Comments
 (0)