Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants