[BUG] string Slug incorrectly parsed as Date if in a specific format
See original GitHub issueI have a controller that looks like so:
@Crud({
model: {
type: Product,
},
params: {
id: {
field: "id",
type: "string",
primary: true,
},
},
When GET ing product with id like so: /api/products/product-123123
The SQL query ends with:
WHERE `Brand`.`bt_brand_id` = ?) `distinctAlias` ORDER BY `Brand_bt_brand_id` ASC LIMIT 100 -- PARAMETERS: ["0122-12-31T21:39:06.000Z"]
When the ID format is not STRING-NUMBER, its all file.
I assume the lib has some heuristics, that are incorrect? Maybe it’s here: https://github.com/nestjsx/crud/blob/3d3f60420072aec296207ecfa06a8f1cb0194f2e/packages/crud-request/src/request-query.parser.ts#L167
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Why does Date.parse give incorrect results? - Stack Overflow
This behaviour is specified in ECMA-262 so all browsers do it the same way. While there is some variance in the input string...
Read more >Date and Time Conversions - APOC Extended Documentation
This function parses a date string in a specified format and converts it to a Neo4j-supported temporal type with date, time, and timezone....
Read more >Date.parse() - JavaScript - MDN Web Docs
The Date.parse() method parses a string representation of a date, and returns the ... A library can help if many different formats are...
Read more >Serializer fields - Django REST framework
input_formats - A list of strings representing the input formats which may be used to parse the date. If not specified, the DATE_INPUT_FORMATS ......
Read more >Cannot query field frontmatter on type markdownremark
No more frontmatter types Tutorial Part Six Error: Cannot query field ... another problem is GraphQL template string doesn't allow string 22 квіт....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
More up to date workaround:
I think its due to json.parse that is part of the pipeline This behavior is not documented and i dont see why regular string wont work