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

@@ -34,8 +34,7 @@
<div class="flex items-center mb-3">
<Calendar class="h-4 w-4 stroke-1.5 mr-2 text-gray-700" />
<span>
{{ dayjs(batch.start_date).format('DD MMM YYYY') }} -
{{ dayjs(batch.end_date).format('DD MMM YYYY') }}
{{ getFormattedDateRange(batch.start_date, batch.end_date) }}
</span>
</div>
<div class="flex items-center">
@@ -48,12 +47,10 @@
</div>
</template>
<script setup>
import { Calendar, Clock, BookOpen } from 'lucide-vue-next'
import { inject } from 'vue'
import { Badge } from 'frappe-ui'
import { formatTime } from '../utils'
import { Calendar, Clock, BookOpen } from 'lucide-vue-next'
import { formatTime, getFormattedDateRange } from '../utils'
const dayjs = inject('$dayjs')
const props = defineProps({
batch: {
type: Object,

View File

@@ -24,8 +24,7 @@
<div class="flex items-center mb-3">
<Calendar class="h-4 w-4 stroke-1.5 mr-2 text-gray-700" />
<span>
{{ dayjs(batch.data.start_date).format('DD MMM YYYY') }} -
{{ dayjs(batch.data.end_date).format('DD MMM YYYY') }}
{{ getFormattedDateRange(batch.data.start_date, batch.data.end_date) }}
</span>
</div>
<div class="flex items-center">
@@ -91,12 +90,15 @@
</div>
</template>
<script setup>
import { formatNumberIntoCurrency, formatTime } from '@/utils'
import { BookOpen, Calendar, Clock } from 'lucide-vue-next'
import { inject, computed } from 'vue'
import { Badge, Button } from 'frappe-ui'
import { BookOpen, Calendar, Clock } from 'lucide-vue-next'
import {
formatNumberIntoCurrency,
formatTime,
getFormattedDateRange,
} from '@/utils'
const dayjs = inject('$dayjs')
const user = inject('$user')
const props = defineProps({