I have been using Ember-CLI-Bootstrap-Datepicker for a while and I had no issue until now that when I am using queryParams to get Date Value for my search purpose the format in may params would be like "date_due_gteq=Thu%20Sep%2001%202016%2000%3A00%3A00%20GMT%2B0800%20(MYT)" which is incorrect. I have searched and found that apparently my date object needs to be convert to ToString however, I have tried but still have the same problem.
that would be great if you guys have a an expericnce with this addon, help me to figure it what is my mistake. I am sharing some part of the code
Template :
Controller:
queryParams: [ "date_due_gteq","date_due_lteq"],
date_due_gteq: null,
date_due_lteq: null,
Routes:
model(params) {
return this.findPaged('task', {
q: {
date_due_gteq: params.date_due_gteq,
date_due_lteq: params.date_due_lteq,
}
});
},
actions: {
queryChanged() {
this.refresh();
}
}
this is possible solution from here http://ift.tt/2cgUiqd
Hey @stonetwig! Because you have a Date object, it's up to you how to transform it into string of any format.
Example:
var today = new Date(); today.toISOString(); // => "2016-03-04T09:20:49.447Z" Using other methods of Date object you could extract year, day, hours, and etc.
Query param could be bound to a Date object not directly, so then you have freedom to transform it into string of required format, and also convert a string of query param into a Date object.
Aucun commentaire:
Enregistrer un commentaire