Created
October 29, 2024 12:44
-
-
Save yurkimus/cb8035dd52849170c4ad5825189e2f9c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Columns = { | |
Coin: 'Coin', | |
Chain: 'Chain', | |
Type: 'Type', | |
Qty: 'Qty', | |
TransactionFee: 'TransactionFee', | |
Address: 'Address', | |
Txid: 'Txid', | |
Status: 'Status', | |
DateTime: 'DateTime', | |
Action: 'Action', | |
} | |
let ColumnIndicies = { | |
[Columns.Coin]: 0, | |
[Columns.Chain]: 1, | |
[Columns.Type]: 2, | |
[Columns.Qty]: 3, | |
[Columns.TransactionFee]: 4, | |
[Columns.Address]: 5, | |
[Columns.Txid]: 6, | |
[Columns.Status]: 7, | |
[Columns.DateTime]: 8, | |
[Columns.Action]: 9, | |
} | |
let locale = navigator.language, | |
options = { | |
dateStyle: 'long', | |
timeStyle: 'short', | |
} | |
Array | |
.from( | |
document | |
.querySelector('tbody') | |
.children, | |
) | |
.map(row => | |
Array | |
.from(row.children) | |
.find((cell, index) => index === ColumnIndicies[Columns.DateTime]) | |
) | |
.forEach( | |
cell => | |
cell.innerText = new Intl | |
.DateTimeFormat(locale, options) | |
.format(new Date(cell.innerText)), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment