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

[Feature Request] Show ISO8601 datetime preview for UNIX times #56

Open
jasongitmail opened this issue Feb 19, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@jasongitmail
Copy link

jasongitmail commented Feb 19, 2024

Describe the solution you'd like

One feature I dream of in a database viewer is an ability to easily view a human-readable ISO8601 datetime string representation of a UNIX time column in a database.

Problem

Currently I store two columns b/c I'm using sqlite, need a UNIX time in my app and to enable easy sorting within my database queries, but also want an human-readable date to help when manually viewing the database using Dataflare.

But this is redundant data and increases the database size.

Solution

Allow right-click on a number-type column to enable preview of UNIX times as an ISO8601 string like 2024-02-16T23:59:59Z and show this as faint gray text next to the blue UNIX time. The code should handle UNIX times in either seconds or milliseconds. Dataflare should remember the setting for the column, if possible.

The reason to make it a column-level setting is to allow it to be disabled if the number does not represent a UNIX time or enabled if it does.

@jasongitmail jasongitmail added the enhancement New feature or request label Feb 19, 2024
@wyhaya
Copy link
Contributor

wyhaya commented Feb 22, 2024

Another way I can think of is to allow write JavaScript script to rewrite cell, but that may be too complicated for many people.

export const rewriteCellValue = (table, column, value) => {

    if(table == 'users' && column == 'create_at') {
        // 2024-02-16T23:59:59Z
        return new Date(value).toISOString()
    }

    if(table == 'users' && column == 'update_at') {
        // 10 days ago
        return timeAgo(value)   
    }

}

@jasongitmail
Copy link
Author

Personally, I'd only want to see the actual date as ISO8601, and not a relative date, given this is for viewing my canonical data and isn't an end user's UX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants