Issue
I have a WebService where I have to modify DATEFIN
by today's date and DATEDEBUT
by a date 1 year before.
Currently, I have this below
Here my dates are entered "manually", how I could create this correctly, please?
getNews(SVM, last) {
var payload = {
"HEADER": this.sh.getHeaderForRequest(),
"SVM": SVM,
"PERIODE": {
"DATEDEBUT": "2018-01-01",
"DATEFIN": "2021-01-01"
},
"LASTX": 0
}
return this.http.post < any[] > (this.getBaseUrl() + `/WLOLARTL`, payload);
}
Here is my method getNews()
getNews() {
return this.api.getNews(this.svm, 20)
.pipe(
map((response: {}) => {
// this.getDetails();
this.prepareData(response);
})
);
}
Thank you so much.
Solution
Somethig like that:
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
previous year:
var previousYear = today.getFullYear() - 1 +'-'+(today.getMonth()+1)+'-'+today.getDate();
Answered By - Cristian18
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.