mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 02:28:54 +08:00
add date filter
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="second-column">
|
<div class="second-column">
|
||||||
<div class="date-container">{{ query.createdAt }}</div>
|
<div class="date-container">{{ query.createdAt | date }}</div>
|
||||||
<div class="icons-container">
|
<div class="icons-container">
|
||||||
<rename-icon />
|
<rename-icon />
|
||||||
<copy-icon />
|
<copy-icon />
|
||||||
@@ -78,6 +78,21 @@ export default {
|
|||||||
new ResizeObserver(this.calcNameWidth).observe(this.$refs.table)
|
new ResizeObserver(this.calcNameWidth).observe(this.$refs.table)
|
||||||
this.calcNameWidth()
|
this.calcNameWidth()
|
||||||
},
|
},
|
||||||
|
filters: {
|
||||||
|
date (value) {
|
||||||
|
if (!value) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric' }
|
||||||
|
const timeOptions = {
|
||||||
|
hour12: false,
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit'
|
||||||
|
}
|
||||||
|
return new Date(value).toLocaleDateString('en-GB', dateOptions) + ' ' +
|
||||||
|
new Date(value).toLocaleTimeString('en-GB', timeOptions)
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
calcNameWidth () {
|
calcNameWidth () {
|
||||||
this.$refs['name-th'].style = `width: ${this.$refs['name-td'][0].offsetWidth}px`
|
this.$refs['name-th'].style = `width: ${this.$refs['name-td'][0].offsetWidth}px`
|
||||||
|
|||||||
Reference in New Issue
Block a user