Skip to content

Commit 6721189

Browse files
committed
feat: add Asia/Bangkok timezone support for budget resets
- Add Asia/Bangkok (UTC+7) to timezone_map in duration_parser.py - Update documentation to include Bangkok in common timezone values - Add test case to verify Bangkok timezone functionality
1 parent bfaab8a commit 6721189

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/my-website/docs/proxy/budget_reset_and_tz.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ Common timezone values:
2929
- `US/Pacific` - Pacific Time
3030
- `Europe/London` - UK Time
3131
- `Asia/Kolkata` - Indian Standard Time (IST)
32+
- `Asia/Bangkok` - Indochina Time (ICT)
3233
- `Asia/Tokyo` - Japan Standard Time
3334
- `Australia/Sydney` - Australian Eastern Time

litellm/litellm_core_utils/duration_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def _setup_timezone(
158158
"US/Eastern": timezone(timedelta(hours=-4)), # EDT
159159
"US/Pacific": timezone(timedelta(hours=-7)), # PDT
160160
"Asia/Kolkata": timezone(timedelta(hours=5, minutes=30)), # IST
161+
"Asia/Bangkok": timezone(timedelta(hours=7)), # ICT (Indochina Time)
161162
"Europe/London": timezone(timedelta(hours=1)), # BST
162163
"UTC": timezone.utc,
163164
}

tests/test_litellm/litellm_core_utils/test_duration_parser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ def test_timezone_handling(self):
8888
)
8989
self.assertEqual(london_result, london_expected)
9090

91+
# Test Bangkok timezone (UTC+7): 5:30 AM next day, so next reset is midnight the day after
92+
bangkok = ZoneInfo("Asia/Bangkok")
93+
bangkok_expected = datetime(2023, 5, 17, 0, 0, 0, tzinfo=bangkok)
94+
bangkok_result = get_next_standardized_reset_time("1d", base_time, "Asia/Bangkok")
95+
self.assertEqual(bangkok_result, bangkok_expected)
96+
9197
def test_edge_cases(self):
9298
"""Test edge cases and boundary conditions"""
9399
# Exactly on hour boundary

0 commit comments

Comments
 (0)