Fix last updated
This commit is contained in:
parent
6d8f7bfae1
commit
9c4ff25239
@ -47,7 +47,17 @@ const usePackageData = () => {
|
||||
const data: CountResponse = await response.json();
|
||||
setStats(data.counts);
|
||||
const dt = new Date(data.lastUpdateTime);
|
||||
setLastUpdated(dt.toLocaleString());
|
||||
const dateLocale = dt.toLocaleDateString(navigator.language, {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
});
|
||||
const timeLocale = dt.toLocaleTimeString(navigator.language, {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
|
||||
setLastUpdated(`${timeLocale} on ${dateLocale}`);
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch stats:', error);
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user