Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bugfix KNOWAGE-8586 #149

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/modules/documentExecution/main/DocumentExecutionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ const removeEmptyToolbarItems = (toolbarMenuItems: any[]) => {
export const getValidDate = (value: string, serverDateFormat: string) => {
const extractedDateValue = extractDatePart(value)
let momentDate = moment(deepcopy(extractedDateValue))
const tempServerDateFormat = serverDateFormat === 'yyyy-MM-dd' ? 'YYYY-MM-DD' : serverDateFormat
const tempServerDateFormat = serverDateFormat.replaceAll('y', 'Y')
const validFormats = [tempServerDateFormat, 'DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss.SSS']
let tempDateFormatFromTheDateValue = extractDateFormatPart(value)
if (tempDateFormatFromTheDateValue) {
tempDateFormatFromTheDateValue = tempDateFormatFromTheDateValue.replaceAll('y', 'Y')
validFormats.unshift(tempDateFormatFromTheDateValue)
}
for (let i = 0; i < validFormats.length; i++) {
momentDate = moment(deepcopy(extractedDateValue), validFormats[i])
if (momentDate.isValid()) return momentDate.toDate()
Expand All @@ -141,3 +146,10 @@ const extractDatePart = (dateString: string) => {
}
return dateString
}

const extractDateFormatPart = (dateString: string) => {
if (dateString.includes('#')) {
return dateString.split('#')[1]
}
return dateString
}
Loading