Skip to content

Commit

Permalink
fix: decimal number deserialization in checks (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt authored Apr 16, 2024
1 parent d588b2c commit 07b75f4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/shared/checks/serialize.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fileURLToPath } from "url"
import type { CheckLogic, CheckParam } from "."
import { CHECKS } from "."

Expand Down Expand Up @@ -29,21 +30,22 @@ const paramSerializer = (param: CheckParam, value: any) => {

function deserializeParamValue(
filterParam: CheckParam,
v: string,
value: string,
): any | undefined {
console.log(value, filterParam.type)
switch (filterParam.type) {
case "select":
if (filterParam.multiple) {
return v.split(",").map(decodeURIComponent)
return value.split(",").map(decodeURIComponent)
} else {
return decodeURIComponent(v)
return decodeURIComponent(value)
}
case "text":
return decodeURIComponent(v)
return decodeURIComponent(value)
case "number":
return Number(v)
return Number(decodeURIComponent(value))
case "date":
return new Date(Number(v))
return new Date(Number(value))
default:
return undefined
}
Expand Down

0 comments on commit 07b75f4

Please sign in to comment.