crate / crate/crate-admin

Rendering of timestamps before 1970-01-01 (negative values in BIGINT) shows "Invalid Timestamp"

Open
#839 2 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
27
Forks
18
PR merge metrics
No merged PRs in 30d

Description

**Issue:**

The AdminUI automatically renders TIMESTAMP fields, which is very convenient.

Anyway, negative millisecond values are valid for dates that are before January 1970.

The following statement demonstrates the issue, the positive timestamp is rendered correctly, the negative one not:
```
-- Correct:
select ('1970-01-01T00:00:00.001000Z')::TIMESTAMP, date_format(1), (1)::TIMESTAMP limit 100;

-- Result
1 (1970-01-01T00:00:00.001Z) | 1970-01-01T00:00:00.001000Z | 1 (1970-01-01T00:00:00.001Z)

-- Incorrect:
select ('1969-12-31T23:59:59.999000Z')::TIMESTAMP, date_format(-1), (-1)::TIMESTAMP limit 100;

-- Result:
-1 (Invalid Timestamp) | 1969-12-31T23:59:59.999000Z | -1 (Invalid Timestamp)
```

**Workaround:**
The issue is not really a problem, just confusing - I thought that my import is wrong, until I figured out this is only a rendering issue.

The `date_format()` function works properly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.