I Have an object which has a Date type property on client side. When I try to send object via HttpClient.post
to server, property's value changes to UTC timezone.
On client side value is Sun Nov 26 2017 00:00:00 GMT+0300 (Turkey Standard Time) but when it goes to server, changes to : 25.11.2017 21:00:00
How can I control This?
This is my class.
export interface IBill {
BillID : number;
SubscriptionID:number;
SiteID : number;
SubscriptionName: string;
Amount: number;
Date: Date;
PaymentDeadline: Date;
Virtual: boolean;
Portioned: boolean;
Issuanced: boolean;
FinancialTransactionComment : string;}
I create an object of this while filling a ng-form, then call following Http.post :
let bill = this.formData;
this.http.post(this.configuration.ServerWithApiUrl + url, bill , { headers: headers, withCredentials: true, observe: "response", responseType: 'text' })
.map((response) => {
return this.parseResponse(response);
}).catch(
(err) =>
this.handleError(err));
public httpPostTypetxt(url: string, object: any, headers: HttpHeaders): Observable<any> { headers = headers.set('Content-Type', 'application/json'); return this.http.post(this.configuration.ServerWithApiUrl + url, object, { headers: headers, withCredentials: true, observe: "response", responseType: 'text' }) .map((response) => { return this.parseResponse(response); }).catch((err) => this.handleError(err, willBlock, loadingBar)); }
– Unreel