0
Staff I have a class that gets a start and end date from a Javascript:
public object getTime(DateTime inicio, DateTime fim) { ... }
I’m going through the dates like this through Javascript:
$.getJSON(`services/api/tempo/getTime/${start.format('YYYY-MM-DD')}/${finish.format('YYYY-MM-DD')}`) { ... }
But I must pass this way:
$.getJSON(`services/api/tempo/getTime/${start.format('YYYY-MM-DDTHH:mm')}/${finish.format('YYYY-MM-DDTHH:mm')}`) { ... }
But this way is making a mistake
GET http://localhost/services/api/tempo/getTime/2020-06-02T14:10/2020-06-02T14:20 400 (Bad Request)
Has anyone ever faced such a thing? Could you please help with this problem?
Error where, on the front on the back? Which error message? Made a console.log of start.format('YYYY-MM-DDTHH:mm') and of Finish.format('YYYY-MM-DDTHH:mm') ?
– Guilherme Nascimento
Front error, I edited the question and added the error.
– user8811593
error is not defined
already says, you are trying to access a variable called error that was not declared, so your error message has nothing to do with date.format and nor with Datetime, has to do with a loose variable not defined and clear, the codes presented in the question have nothing to do with this.– Guilherme Nascimento
The same problem is the first error. This error is a var that I took from the code and forgot to take from the return. But the same problem is that bad request. This Bad Request only happens when I use the date in this informed way.
– user8811593
Okay, this giving bad request, means that the debugger is off or that you are not looking at the Devtools network console or not looking at the visualstudio (if the test is in place) the exceptions, there is no way to guess, Another thing, I asked two questions and I’ll be forced to repeat them: Did a start.format('YYYY-MM-DDTHH:mm') and Finish.format('YYYY-MM-DDTHH:mm') console? What do they return? Understand that to help you you need to provide these details, after all it is the least. I am waiting to help you.
– Guilherme Nascimento
I did yes returns the dates 2020-06-02T16:30... I made the URI Meeting quoted below and returned 2020-06-02T16%3A01, but Ianda is with bad request.
– user8811593
Okay, but in Visualstudio, does the error breakpoint display the details at the moment? Is Exception generated or not? As I said, and I already asked you 4 questions that you did not answer any, give the details, we can not guess important details
– Guilherme Nascimento