Migrate from lb2 to lv4, convert timestamp string to date error: timestamp string is not a valid date, it also appears in lb3 #7906
Replies: 2 comments
-
I am not 100% sure if it's the right option, but I think an interceptor can help you in this case. Here in number 3 there is an example of how to use an interceptor to change a string to upper case. Also, I created a repo with a sample of how you could use the interceptor to fix your date issue: However, I was not able to keep the CRUD validations, as those will execute before the interceptor, causing it to return an error. See here @dhmlau what do you think? Is this a good use case of an interceptor? or what would you recommend? Also, Is there any way we could make the interceptor execute before the CRUD validation (from the requestBody decorator)? |
Beta Was this translation helpful? Give feedback.
-
It seems more convenient to create a dateFormat method for processing
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Env:
Database model:
Request body: put
{"model":"SavedAnalysis","data":{"title":"RF-A-13-SavedAnalysesSpotlights-1","createdDate":"1631951099611","authorEmail":"xxx@gmail.com"}}
Method
app = require('../../server/server'); <== lb3app server
app.models['SavedAnalysis'].upsert(data)
dependencies:
Error:
I found it might relate to loopback-datasource-juggler model-builder lib
Do we rewrite the Date method? It works well when I remove new keyword.
Can anyone give me some hints?
Thanks!
@bajtos @rmg @achrinza @emazzu @raymondfeng
Beta Was this translation helpful? Give feedback.
All reactions