fix: handle same start and end dates case for batch

* also minor refactor
This commit is contained in:
Hussain Nagaria
2024-04-16 21:24:53 +05:30
parent 255990b022
commit f48f437075
5 changed files with 36 additions and 24 deletions

View File

@@ -8,6 +8,7 @@ import Paragraph from '@editorjs/paragraph'
import Embed from '@editorjs/embed'
import NestedList from '@editorjs/nested-list'
import { watch } from 'vue'
import dayjs from '@/utils/dayjs'
export function createToast(options) {
toast({
@@ -322,3 +323,12 @@ export function getSidebarLinks() {
},
]
}
export function getFormattedDateRange(startDate, endDate) {
if (startDate === endDate) {
return dayjs(startDate).format('DD MMM YYYY')
}
return `${dayjs(startDate).format('DD MMM YYYY')} - ${dayjs(endDate).format(
'DD MMM YYYY'
)}`
}