mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-18 00:48:01 +00:00
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
This commit is contained in:
@@ -29,5 +29,6 @@ Common timezone values:
|
||||
- `US/Pacific` - Pacific Time
|
||||
- `Europe/London` - UK Time
|
||||
- `Asia/Kolkata` - Indian Standard Time (IST)
|
||||
- `Asia/Bangkok` - Indochina Time (ICT)
|
||||
- `Asia/Tokyo` - Japan Standard Time
|
||||
- `Australia/Sydney` - Australian Eastern Time
|
||||
|
||||
@@ -158,6 +158,7 @@ def _setup_timezone(
|
||||
"US/Eastern": timezone(timedelta(hours=-4)), # EDT
|
||||
"US/Pacific": timezone(timedelta(hours=-7)), # PDT
|
||||
"Asia/Kolkata": timezone(timedelta(hours=5, minutes=30)), # IST
|
||||
"Asia/Bangkok": timezone(timedelta(hours=7)), # ICT (Indochina Time)
|
||||
"Europe/London": timezone(timedelta(hours=1)), # BST
|
||||
"UTC": timezone.utc,
|
||||
}
|
||||
|
||||
@@ -88,6 +88,12 @@ class TestStandardizedResetTime(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(london_result, london_expected)
|
||||
|
||||
# Test Bangkok timezone (UTC+7): 5:30 AM next day, so next reset is midnight the day after
|
||||
bangkok = ZoneInfo("Asia/Bangkok")
|
||||
bangkok_expected = datetime(2023, 5, 17, 0, 0, 0, tzinfo=bangkok)
|
||||
bangkok_result = get_next_standardized_reset_time("1d", base_time, "Asia/Bangkok")
|
||||
self.assertEqual(bangkok_result, bangkok_expected)
|
||||
|
||||
def test_edge_cases(self):
|
||||
"""Test edge cases and boundary conditions"""
|
||||
# Exactly on hour boundary
|
||||
|
||||
Reference in New Issue
Block a user