long date format
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
||||||
import { formatDate, formatDiffInMinutes } from '@/shared/format-date'
|
import { formatDiffInMinutes, formatLongDate } from '@/shared/format-date'
|
||||||
import { toISODate } from '@/shared/types/date'
|
import { toISODate } from '@/shared/types/date'
|
||||||
import { useMagicKeys, whenever } from '@vueuse/core'
|
import { useMagicKeys, whenever } from '@vueuse/core'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
@@ -101,7 +101,7 @@ const isSuperiorToEstimation = computed(() => {
|
|||||||
{{ task.title }}
|
{{ task.title }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</h1>
|
</h1>
|
||||||
<h2>start time: {{ formatDate(record.start) }}</h2>
|
<h2>{{ formatLongDate(record.start) }}</h2>
|
||||||
<template v-if="!record.end">
|
<template v-if="!record.end">
|
||||||
<button
|
<button
|
||||||
v-if="!recordStore.currentStepId && !record.hasStepRecords"
|
v-if="!recordStore.currentStepId && !record.hasStepRecords"
|
||||||
|
|||||||
@@ -3,6 +3,16 @@ import type { ISODate } from './types/date'
|
|||||||
export const formatDate = (date: Date | string) =>
|
export const formatDate = (date: Date | string) =>
|
||||||
new Date(date).toLocaleString()
|
new Date(date).toLocaleString()
|
||||||
|
|
||||||
|
export const formatLongDate = (date: Date | ISODate) =>
|
||||||
|
new Date(date).toLocaleString(undefined, {
|
||||||
|
weekday: 'long',
|
||||||
|
day: '2-digit',
|
||||||
|
month: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
hour: 'numeric',
|
||||||
|
minute: 'numeric'
|
||||||
|
})
|
||||||
|
|
||||||
export const formatDiffInMinutes = (date1: ISODate, date2: ISODate) => {
|
export const formatDiffInMinutes = (date1: ISODate, date2: ISODate) => {
|
||||||
const diffInMs = new Date(date2).getTime() - new Date(date1).getTime()
|
const diffInMs = new Date(date2).getTime() - new Date(date1).getTime()
|
||||||
// TODO: diff in minutes not in seconds
|
// TODO: diff in minutes not in seconds
|
||||||
|
|||||||
Reference in New Issue
Block a user