Fixed an error where toFixed() wouldn't round correctly. Added a util function that does a better job (at least for 2 digits precision)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { computed } from 'vue'
|
||||
import { type Invoice } from '@/types'
|
||||
import { toLocalDate, toCurrency } from '@/lib/utils'
|
||||
import { toLocalDate, toCurrency, toFixedRounded } from '@/lib/utils'
|
||||
import { StatusBadge, statusBadgeLabels, statusBadgeTextColor, castToStatusVariant } from '@/components/ui/status-badge'
|
||||
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from '@/components/ui/table'
|
||||
|
||||
@@ -97,7 +97,7 @@ const totalGross = computed(() => {
|
||||
})
|
||||
|
||||
const calcTaxes = (amount: number) => {
|
||||
return Number((0.19 * amount).toFixed(2))
|
||||
return toFixedRounded(Number(0.19 * amount), 2)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user