-
Notifications
You must be signed in to change notification settings - Fork 897
Closed
Labels
user issueAn issue or bug reported by usersAn issue or bug reported by users
Description
Hi,
I have identified a couple of bugs in the iif and getDate functions defined in the file packages/survey-core/src/functionsfactory.ts. Below are the details:
1. iif Function
- Bug: The condition
if (!params && params.length !== 3)is incorrect. It should beif (!params || params.length !== 3)to correctly handle cases whereparamsisnullorundefined. - Current Code:
function iif(params: any[]): any { if (!params && params.length !== 3) return ""; return params[0] ? params[1] : params[2]; }
- Corrected Code:
function iif(params: any[]): any { if (!params || params.length !== 3) return ""; return params[0] ? params[1] : params[2]; }
2. getDate Function
- Bug: The condition
if (!params && params.length < 1)is incorrect. It should beif (!params || params.length < 1)to correctly handle cases whereparamsisnullorundefined. - Current Code:
function getDate(params: any[]): any { if (!params && params.length < 1) return null; if (!params[0]) return null; return createDate("function-getDate", params[0]); }
- Corrected Code:
function getDate(params: any[]): any { if (!params || params.length < 1) return null; if (!params[0]) return null; return createDate("function-getDate", params[0]); }
Metadata
Metadata
Assignees
Labels
user issueAn issue or bug reported by usersAn issue or bug reported by users