Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fees for the past d h not updating if tab is left open #1405

Merged

Conversation

midas-myth
Copy link
Collaborator

@midas-myth midas-myth commented Nov 25, 2024


@midas-myth midas-myth self-assigned this Nov 25, 2024
@midas-myth midas-myth changed the base branch from master to release-50 November 25, 2024 18:26
Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for vigilant-albattani-df38ec ready!

Name Link
🔨 Latest commit cf5d731
🔍 Latest deploy log https://app.netlify.com/sites/vigilant-albattani-df38ec/deploys/67485a1ba81b440008a621a9
😎 Deploy Preview https://deploy-preview-1405--vigilant-albattani-df38ec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2024

Deploying gmx-interface with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf5d731
Status: ✅  Deploy successful!
Preview URL: https://5af7d9ac.gmx-interface.pages.dev
Branch Preview URL: https://fees-for-the-past-d-h-not-up.gmx-interface.pages.dev

View logs

@midas-myth midas-myth changed the base branch from release-50 to release-51 November 27, 2024 15:28
onemicky
onemicky previously approved these changes Nov 27, 2024
let restHours = Math.round((now - epochStartedTimestamp) / 3600) - days * 24;
if (days === 0) {
restHours = Math.max(restHours, 1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion to consider usage date-fns for this date operations with :

import { differenceInDays, differenceInHours } from 'date-fns';


const now = new Date();
const epochStartedDate = new Date(epochStartedTimestamp * 1000);

const days = differenceInDays(now, epochStartedDate);
let restHours = differenceInHours(now, epochStartedDate) - days * 24;

if (days === 0) {
  restHours = Math.max(restHours, 1);
}

It's up to you which variant to keep, I'm also ok with yours

@midas-myth midas-myth merged commit ea0701a into release-51 Dec 2, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants