Closed hussedev closed 2 months ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
builder | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 26, 2024 4:45pm |
builder-staging | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 26, 2024 4:45pm |
explorer | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 26, 2024 4:45pm |
explorer-staging | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 26, 2024 4:45pm |
manager | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 26, 2024 4:45pm |
manager-staging | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jun 26, 2024 4:45pm |
Fixes: #issue https://github.com/gitcoinco/grants-stack/issues/3536
Description
Our data layer is not checking if round dates are null when fetched from the indexer:![image](https://github.com/gitcoinco/grants-stack/assets/22710836/838453e8-56e3-49b5-9fc3-81dd5b7274b9)
getRoundForExplorer() -> packages/data-layer/src/data-layer.ts![image](https://github.com/gitcoinco/grants-stack/assets/22710836/2bfc67c2-f892-42c0-987f-bbf540ca2af9)
Converting null to Date becomes ->
1970-01-01T00:00:00.000Z
(timestamp 0 / Computer Dinosaur Age)That's the main issue, depending on the timezone, it can be greater or lower than that.
One solution would be to convert all dates to UTC and make calculations from there. Another solution would be that the data-layer leave null dates as null or undefined instead of converting it.
We currently have this function to address this issue:
But it wasn't taking in consideration that the year can become 1969 depending on the Timezone.
Changed the check from === 1970 to <= 1970
An alternative solution would be:
Checklist
This PR:
@ts-ignore
, unjustified optional values).