Skip to content

Commit d4eabf2

Browse files
committed
fix linting
1 parent 93b44df commit d4eabf2

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

backend/app/services/implementations/intake_form_processor.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,13 @@ def _process_demographics(self, user_data: UserData, demographics: Dict[str, Any
180180
user_data.ethnic_group = demographics.get("ethnic_group", [])
181181
user_data.marital_status = self._trim_text(demographics.get("marital_status"))
182182
user_data.has_kids = demographics.get("has_kids")
183-
183+
184184
# Validate and set timezone
185185
timezone = self._trim_text(demographics.get("timezone"))
186186
if timezone and timezone not in VALID_TIMEZONES:
187-
raise ValueError(
188-
f"Invalid timezone: {timezone}. Must be one of {sorted(VALID_TIMEZONES)}"
189-
)
187+
raise ValueError(f"Invalid timezone: {timezone}. Must be one of {sorted(VALID_TIMEZONES)}")
190188
user_data.timezone = timezone
191-
189+
192190
user_data.other_ethnic_group = self._trim_text(demographics.get("ethnic_group_custom"))
193191
user_data.gender_identity_custom = self._trim_text(demographics.get("gender_identity_custom"))
194192

backend/migrations/versions/2ccee7a88d08_add_timezone_column_to_user_data.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@
55
Create Date: 2025-10-30 19:02:10.801071
66
77
"""
8+
89
from typing import Sequence, Union
910

1011
import sqlalchemy as sa
1112
from alembic import op
1213

1314
# revision identifiers, used by Alembic.
14-
revision: str = '2ccee7a88d08'
15-
down_revision: Union[str, None] = '9f1a6d727929'
15+
revision: str = "2ccee7a88d08"
16+
down_revision: Union[str, None] = "9f1a6d727929"
1617
branch_labels: Union[str, Sequence[str], None] = None
1718
depends_on: Union[str, Sequence[str], None] = None
1819

1920

2021
def upgrade() -> None:
2122
# ### commands auto generated by Alembic - please adjust! ###
22-
op.add_column('user_data', sa.Column('timezone', sa.Text(), nullable=True))
23+
op.add_column("user_data", sa.Column("timezone", sa.Text(), nullable=True))
2324
# ### end Alembic commands ###
2425

2526

2627
def downgrade() -> None:
2728
# ### commands auto generated by Alembic - please adjust! ###
28-
op.drop_column('user_data', 'timezone')
29+
op.drop_column("user_data", "timezone")
2930
# ### end Alembic commands ###

frontend/src/utils/timezoneUtils.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ export function detectCanadianTimezone(): string {
66
try {
77
// Use Intl API to get the IANA timezone identifier
88
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
9-
9+
1010
// Map IANA timezone identifiers to Canadian timezone abbreviations
1111
const timezoneMap: Record<string, string> = {
1212
// Newfoundland Standard Time
1313
'America/St_Johns': 'NST',
14-
14+
1515
// Atlantic Standard Time
1616
'America/Halifax': 'AST',
1717
'America/Moncton': 'AST',
1818
'America/Glace_Bay': 'AST',
1919
'America/Goose_Bay': 'AST',
2020
'America/Blanc-Sablon': 'AST',
21-
21+
2222
// Eastern Standard Time
2323
'America/Toronto': 'EST',
2424
'America/Montreal': 'EST',
@@ -27,12 +27,12 @@ export function detectCanadianTimezone(): string {
2727
'America/Nipigon': 'EST',
2828
'America/Rainy_River': 'EST',
2929
'America/Atikokan': 'EST',
30-
30+
3131
// Central Standard Time
3232
'America/Winnipeg': 'CST', // Manitoba uses Central Time
3333
'America/Regina': 'CST',
3434
'America/Swift_Current': 'CST',
35-
35+
3636
// Mountain Standard Time
3737
'America/Edmonton': 'MST',
3838
'America/Calgary': 'MST',
@@ -41,24 +41,24 @@ export function detectCanadianTimezone(): string {
4141
'America/Cambridge_Bay': 'MST',
4242
'America/Dawson_Creek': 'MST',
4343
'America/Fort_Nelson': 'MST',
44-
44+
4545
// Pacific Standard Time
4646
'America/Vancouver': 'PST',
4747
'America/Whitehorse': 'PST',
4848
'America/Dawson': 'PST',
4949
};
50-
50+
5151
// Check if we have a direct mapping
5252
if (timezoneMap[timeZone]) {
5353
return timezoneMap[timeZone];
5454
}
55-
55+
5656
// Fallback: Use timezone offset to estimate
5757
// Get UTC offset in hours (accounting for DST)
5858
const now = new Date();
5959
const offsetMinutes = now.getTimezoneOffset();
6060
const offsetHours = -offsetMinutes / 60; // Invert because getTimezoneOffset returns opposite sign
61-
61+
6262
// Map UTC offsets to Canadian timezones (accounting for DST)
6363
// During DST, offsets are shifted by 1 hour, so we map to standard time equivalents
6464
if (offsetHours === -3.5 || offsetHours === -2.5) return 'NST'; // Newfoundland (standard or daylight)
@@ -67,11 +67,10 @@ export function detectCanadianTimezone(): string {
6767
if (offsetHours === -6 || offsetHours === -5) return 'CST'; // Central (standard or daylight)
6868
if (offsetHours === -7 || offsetHours === -6) return 'MST'; // Mountain (standard or daylight)
6969
if (offsetHours === -8 || offsetHours === -7) return 'PST'; // Pacific (standard or daylight)
70-
70+
7171
return '';
7272
} catch (error) {
7373
console.warn('Unable to detect timezone:', error);
7474
return '';
7575
}
7676
}
77-

0 commit comments

Comments
 (0)