Skip to content

Commit

Permalink
fix: Export records with date field.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Jun 20, 2024
1 parent b6a88b0 commit 9e161b7
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/utils/ADempiere/valueFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
import { NUMBER_PRECISION } from '@/utils/ADempiere/formatValue/numberFormat.js'

// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { getTypeOfValue, isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { convertBooleanToTranslationLang } from './formatValue/booleanFormat'
export { convertObjectToKeyValue } from '@/utils/ADempiere/formatValue/iterableFormat'
import { decodeHtmlEntities } from '@/utils/ADempiere/formatValue/stringFormat.js'
Expand Down Expand Up @@ -94,6 +94,10 @@ export function formatField({
break

case DATE.id:
// date is object { value, type }
if (getTypeOfValue(value) === 'OBJECT' && Object.prototype.hasOwnProperty.call(value, 'value')) {
value = value.value
}
formattedValue = formatDateTemp({
value,
isTime: false,
Expand All @@ -106,13 +110,21 @@ export function formatField({
break

case DATE_PLUS_TIME.id:
// date is object { value, type }
if (getTypeOfValue(value) === 'OBJECT' && Object.prototype.hasOwnProperty.call(value, 'value')) {
value = value.value
}
formattedValue = formatDateTemp({
value,
isTime: true,
format: optionalFormat || 'yyyy-MM-dd hh:mm:ss A'
})
break
case TIME.id:
// date is object { value, type }
if (getTypeOfValue(value) === 'OBJECT' && Object.prototype.hasOwnProperty.call(value, 'value')) {
value = value.value
}
formattedValue = formatDateTemp({
value,
isTime: true,
Expand All @@ -126,19 +138,31 @@ export function formatField({

case AMOUNT.id:
case COSTS_PLUS_PRICES.id:
// number is object { value, type }
if (getTypeOfValue(value) === 'OBJECT' && Object.prototype.hasOwnProperty.call(value, 'value')) {
value = value.value
}
formattedValue = formatPriceTemp({
value,
currency
})
break

case NUMBER.id:
// number is object { value, type }
if (getTypeOfValue(value) === 'OBJECT' && Object.prototype.hasOwnProperty.call(value, 'value')) {
value = value.value
}
formattedValue = formatQuantity({
value,
precision: NUMBER_PRECISION
})
break
case QUANTITY.id:
// number is object { value, type }
if (getTypeOfValue(value) === 'OBJECT' && Object.prototype.hasOwnProperty.call(value, 'value')) {
value = value.value
}
formattedValue = formatQuantity({
value
})
Expand Down

0 comments on commit 9e161b7

Please sign in to comment.