Parse timestamps using day.js

This commit is contained in:
RunasSudo 2024-11-16 21:24:45 +11:00
parent aff795745c
commit 8def6bf046
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
5 changed files with 19 additions and 4 deletions

View File

@ -15,6 +15,7 @@
"@tauri-apps/plugin-shell": "^2", "@tauri-apps/plugin-shell": "^2",
"@tauri-apps/plugin-sql": "~2", "@tauri-apps/plugin-sql": "~2",
"clusterize.js": "^1.0.0", "clusterize.js": "^1.0.0",
"dayjs": "^1.11.13",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-router": "4" "vue-router": "4"
}, },

View File

@ -23,6 +23,9 @@ importers:
clusterize.js: clusterize.js:
specifier: ^1.0.0 specifier: ^1.0.0
version: 1.0.0 version: 1.0.0
dayjs:
specifier: ^1.11.13
version: 1.11.13
vue: vue:
specifier: ^3.3.4 specifier: ^3.3.4
version: 3.5.12(typescript@5.6.3) version: 3.5.12(typescript@5.6.3)
@ -581,6 +584,9 @@ packages:
csstype@3.1.3: csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
dayjs@1.11.13:
resolution: {integrity: sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==}
de-indent@1.0.2: de-indent@1.0.2:
resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==}
@ -1429,6 +1435,8 @@ snapshots:
csstype@3.1.3: {} csstype@3.1.3: {}
dayjs@1.11.13: {}
de-indent@1.0.2: {} de-indent@1.0.2: {}
didyoumean@1.2.2: {} didyoumean@1.2.2: {}

View File

@ -54,6 +54,8 @@
<script setup lang="ts"> <script setup lang="ts">
import Clusterize from 'clusterize.js'; import Clusterize from 'clusterize.js';
import dayjs from 'dayjs';
import { onUnmounted, ref } from 'vue'; import { onUnmounted, ref } from 'vue';
import { asCost } from '../amounts.ts'; import { asCost } from '../amounts.ts';
@ -86,7 +88,7 @@
for (const transaction of transactions) { for (const transaction of transactions) {
rows.push( rows.push(
`<tr class="border-t border-gray-300"> `<tr class="border-t border-gray-300">
<td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ transaction.dt.split(' ')[0] }</td> <td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ dayjs(transaction.dt).format('YYYY-MM-DD') }</td>
<td class="py-0.5 px-1 text-gray-900" colspan="3">${ transaction.description }</td> <td class="py-0.5 px-1 text-gray-900" colspan="3">${ transaction.description }</td>
<td></td> <td></td>
<td></td> <td></td>

View File

@ -41,6 +41,8 @@
<script setup lang="ts"> <script setup lang="ts">
import Clusterize from 'clusterize.js'; import Clusterize from 'clusterize.js';
import dayjs from 'dayjs';
import { onMounted, onUnmounted, watch } from 'vue'; import { onMounted, onUnmounted, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -78,7 +80,7 @@
for (const transaction of transactions) { for (const transaction of transactions) {
rows.push( rows.push(
`<tr class="border-t border-gray-300"> `<tr class="border-t border-gray-300">
<td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ transaction.dt.split(' ')[0] }</td> <td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ dayjs(transaction.dt).format('YYYY-MM-DD') }</td>
<td class="py-0.5 px-1 text-gray-900"> <td class="py-0.5 px-1 text-gray-900">
${ transaction.description } ${ transaction.description }
<!-- TODO: Edit button --> <!-- TODO: Edit button -->

View File

@ -42,6 +42,8 @@
<script setup lang="ts"> <script setup lang="ts">
import Clusterize from 'clusterize.js'; import Clusterize from 'clusterize.js';
import dayjs from 'dayjs';
import { onMounted, onUnmounted, watch } from 'vue'; import { onMounted, onUnmounted, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -73,7 +75,7 @@
rows.push( rows.push(
`<tr class="border-t border-gray-300"> `<tr class="border-t border-gray-300">
<td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ transaction.dt.split(' ')[0] }</td> <td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ dayjs(transaction.dt).format('YYYY-MM-DD') }</td>
<td class="py-0.5 px-1 text-gray-900"> <td class="py-0.5 px-1 text-gray-900">
${ transaction.description } ${ transaction.description }
<!-- TODO: Edit button --> <!-- TODO: Edit button -->
@ -89,7 +91,7 @@
// Complex transaction // Complex transaction
rows.push( rows.push(
`<tr class="border-t border-gray-300"> `<tr class="border-t border-gray-300">
<td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ transaction.dt.split(' ')[0] }</td> <td class="py-0.5 pr-1 text-gray-900 lg:w-[12ex]">${ dayjs(transaction.dt).format('YYYY-MM-DD') }</td>
<td colspan="2" class="py-0.5 px-1 text-gray-900"> <td colspan="2" class="py-0.5 px-1 text-gray-900">
${ transaction.description } ${ transaction.description }
<!-- TODO: Edit button --> <!-- TODO: Edit button -->