Convert refresh time to local time.

This commit is contained in:
SergeantPanda 2025-09-09 16:43:57 -05:00
parent c25de2a191
commit d1a5143312
2 changed files with 18 additions and 9 deletions

View file

@ -140,16 +140,16 @@ class Client:
"""Get account information from the last authentication response"""
if not self.server_info:
raise ValueError("Not authenticated. Call authenticate() first.")
from datetime import datetime
# Extract relevant account information
user_info = self.server_info.get('user_info', {})
server_info = self.server_info.get('server_info', {})
account_info = {
'last_refresh': datetime.now().isoformat(),
'auth_timestamp': datetime.now().timestamp(),
'last_refresh': datetime.utcnow().isoformat() + 'Z', # Explicit UTC with Z suffix
'auth_timestamp': datetime.utcnow().timestamp(),
'user_info': {
'username': user_info.get('username'),
'password': user_info.get('password'),
@ -174,7 +174,7 @@ class Client:
'time_now': server_info.get('time_now')
}
}
return account_info
def get_live_categories(self):

View file

@ -47,9 +47,18 @@ const AccountInfoModal = ({ isOpen, onClose, profile }) => {
try {
const date =
typeof timestamp === 'string' && timestamp.includes('T')
? new Date(timestamp)
? new Date(timestamp) // This should handle ISO format properly
: new Date(parseInt(timestamp) * 1000);
return date.toLocaleString();
// Convert to user's local time and display with timezone
return date.toLocaleString(undefined, {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
timeZoneName: 'short',
});
} catch {
return 'Invalid date';
}
@ -330,7 +339,7 @@ const AccountInfoModal = ({ isOpen, onClose, profile }) => {
>
<Group spacing="xs" align="center">
<Text fw={500} size="sm">
Last Updated:
Last Account Info Refresh:
</Text>
<Badge variant="light" color="gray" size="sm">
{last_refresh ? formatTimestamp(last_refresh) : 'Never'}