Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yurkimus/cb8035dd52849170c4ad5825189e2f9c to your computer and use it in GitHub Desktop.
Save yurkimus/cb8035dd52849170c4ad5825189e2f9c to your computer and use it in GitHub Desktop.
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