Skip to content

Commit

Permalink
[KNOWAGE-7893]
Browse files Browse the repository at this point in the history
  • Loading branch information
Redjaw authored Aug 6, 2024
2 parents cadaad6 + fa79299 commit f7db8d8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/modules/qbe/qbeDialogs/qbeFilterDialog/QBEFilterCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ import Dropdown from 'primevue/dropdown'
import QBEFilterDialogDescriptor from './QBEFilterDialogDescriptor.json'
import QBEFilterValuesTable from './QBEFilterValuesTable.vue'
import moment from 'moment'
import { getLocale, localeDate } from '@/helpers/commons/localeHelper'
export default defineComponent({
name: 'qbe-filter-card',
Expand Down Expand Up @@ -309,9 +310,23 @@ export default defineComponent({
},
onManualValueChange() {
if (this.filter) {
const isDateOrTimestamp = ['DATE', 'TIMESTAMP'].includes(this.field?.id?.type)
if (isDateOrTimestamp) this.formatManualDate()
this.filter.rightOperandValue = [this.filter.rightOperandDescription]
}
},
formatManualDate() {
if (!this.filter) return
const serverFormat = 'DD/MM/YYYY hh:mm'
const format = localeDate().replace(/yyyy/g, 'YYYY').replace(/dd/g, 'DD').replace(/d/g, 'D').replace(/MM/g, 'MM').replace(/M/g, 'M').replace(/hh/g, 'HH').replace(/mm/g, 'mm').replace(/ss/g, 'ss').replace(/SSS/g, 'SSS')
const momentDate = moment(this.filter.rightOperandDescription, format, true)
if (momentDate.isValid()) {
const formattedDate = momentDate.format(serverFormat)
this.filter.rightOperandDescription = formattedDate
}
},
onManualBetweenChange() {
if (this.filter) {
this.filter.rightOperandValue = [this.firstOperand, this.secondOperand]
Expand Down

0 comments on commit f7db8d8

Please sign in to comment.