Skip to content

Commit

Permalink
Bugfix KNOWAGE-7893
Browse files Browse the repository at this point in the history
  • Loading branch information
BojanSovticEngIT committed Oct 30, 2024
1 parent ee2a649 commit 1e08d94
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/modules/qbe/qbeDialogs/qbeFilterDialog/QBEFilterCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ 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 @@ -310,23 +309,9 @@ 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
19 changes: 19 additions & 0 deletions src/modules/qbe/qbeDialogs/qbeFilterDialog/QBEFilterDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { defineComponent, PropType } from 'vue'
import { AxiosResponse } from 'axios'
import { iField, iQuery, iFilter } from '../../QBE'
import { removeInPlace } from '../qbeAdvancedFilterDialog/treeService'
import { localeDate } from '@/helpers/commons/localeHelper'
import Dialog from 'primevue/dialog'
import KnFabButton from '@/components/UI/KnFabButton.vue'
import Message from 'primevue/message'
Expand All @@ -47,6 +48,7 @@ import mainStore from '../../../../App.store'
import cryptoRandomString from 'crypto-random-string'
import deepcopy from 'deepcopy'
import UserFunctionalitiesConstants from '@/UserFunctionalitiesConstants.json'
import moment from 'moment'
export default defineComponent({
name: 'qbe-filter-dialog',
Expand Down Expand Up @@ -269,6 +271,23 @@ export default defineComponent({
this.parameterTableVisible = false
}
},
formatManualDatesFiltersForSave() {
this.filters?.forEach((filter: iFilter) => {
const field = this.filterDialogData?.field as any
const isDateOrTimestamp = ['DATE', 'TIMESTAMP'].includes(field?.id?.type)
if (isDateOrTimestamp) this.formatManualDate(filter)
})
},
formatManualDate(filter: iFilter) {
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(filter.rightOperandDescription, format, true)
if (momentDate.isValid()) {
const formattedDate = momentDate.format(serverFormat)
filter.rightOperandDescription = formattedDate
}
},
onParametersUpdated(updatedParameters: any[]) {
this.updatedParameters = updatedParameters
},
Expand Down

0 comments on commit 1e08d94

Please sign in to comment.