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

Incorrectly converting stripe timestamps to DateTimes #225

Closed
ericallam opened this issue Jul 28, 2023 · 1 comment
Closed

Incorrectly converting stripe timestamps to DateTimes #225

ericallam opened this issue Jul 28, 2023 · 1 comment

Comments

@ericallam
Copy link

Currently timestamps are hydrated to Dates using the following function:

export const toDateTime = (secs: number) => {
  var t = new Date('1970-01-01T00:30:00Z'); // Unix epoch start.
  t.setSeconds(secs);
  return t;
};

A couple issues here:

  • Unix epoch is starting 30 minutes late
  • You could just do new Date(secs * 1000)
@leerob
Copy link
Member

leerob commented Feb 12, 2024

#278

@leerob leerob closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants