suppose, I select 03-21-2019 it saved as 03-20-2019.
This is the code I am using to save in Typescript.
input.creatioN_TIME = moment(this.CreateDate);
input.expirY_DATE = moment(this.ExpiryDate);
this._organizationService.createOrUpdateASAPOrganizationsHub(input)
.pipe(finalize(() => this.saving = false))
.subscribe(() => {
this.notify.info(this.l('SavedSuccessfully'));
this.OrganizationSave.emit(this.organization);
this._router.navigate(['app/admin/ASAPOrganizationHub']);
});
5 Answer(s)
-
0
Hi, it is probably due to non-utc datetime to utc conversion.
if
ClockProviders.Utc
is used, the client side date time will be converted in utc before sending to the server.See https://aspnetboilerplate.com/Pages/Documents/Timing.
-
0
would you send me format
-
0
Hi,
- Have you set ClockProviders.Utc to UtcClockProvider ?
- Could you send the date send to server from client ? You can check it in the network tab of Google Chrome for your request.
-
0
I am having the same problem, And I have set Clock.Provider = ClockProviders.Utc; Now I am storing dates which I don't want to be converted and store the data as it is.
In order to do that what I need to do so that it deosn't convert and store the data as it is.
-
0
I ran into a similar problem using UTC as my clockProvider on the server side. The resolution I found was, before submitting from client side to server side for processing, you need to specify the format of the datetime object.
Below is jQuery but gives you the idea:
$('.datetime-picker').datetimepicker({ minDate: new Date(), locale: abp.localization.currentLanguage.name, format: 'L LT' });
to render you Datetime field selector to your end user. Before posting to server:
var formattedDate = $("#Notification_AutoBroadcastDate").data("DateTimePicker").date().format("YYYY-MM-DDTHH:mmZ");
and return formattedDate to your server for processing, which will include the timezone offset.
If you do not include the timezone offset when submitting to server, it is assumed to be a UTC date.