mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-22 18:28:00 +00:00
Convert refresh time to local time.
This commit is contained in:
parent
c25de2a191
commit
d1a5143312
2 changed files with 18 additions and 9 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue