Skip to content

Replies

0
Nikolay Alipiev
Nikolay Alipiev answered on Jul 18, 2019 7:08 PM

Hello, Orange Eagle.

Please follow this issue in our igniteui-angular repository. We will keep in mind your request and will think for a solution. Thank you for using our product!

Best regards,

Nikolay Alipiev

Sofware Developer

0
Nikolay Alipiev
Nikolay Alipiev answered on Apr 11, 2019 3:06 PM

Hi, Héctor.

We have discussed this matter internally in our case system, but I'm going to post my answer here also.

I'm attaching a modified demo, where some of the WebDropDown classes are overwritten in order to achieve design similar to the ASP.NET Drop Down. Because both controls are different and WebDropDown has his own containers, custom CSS classes are needed.

Thank you once again for using our product!

Best regards,

Nikolay Alipiev

Software Developer

WebDropDownStyling.zip

0
Nikolay Alipiev
Nikolay Alipiev answered on Nov 22, 2018 10:10 AM

Hi, Veselina.

The other option you have is in your sample (before my changes) is to delete DisplayTimeOffset setting, instead of setting it to null. Can you try this also?

Regards,

Nikolay Alipiev

0
Nikolay Alipiev
Nikolay Alipiev answered on Nov 21, 2018 8:01 PM

Hi, Veselina.

I hope that I will be able to help you with my answer. Thank you again for using our product!

I think we are experiencing the same thing as you and I will share some details to ensure we understood you correctly.

We are currently located in Bulgaria, which is UTC+03:00. The day light saving time was introduced in our country in 1979, that is why when in the console we type:

new Date(1976, 5, 13, 0, 0, 0).toString() the result is "Sun Jun 13 1976 00:00:00 GMT+0200 (Eastern European Standard Time)".

For any year after the 1979, the result is +0300 during summer time. Taking the date that is in your solution:

new Date(2018, 5, 13, 0, 0, 0).toString() the result is "Wed Jun 13 2018 00:00:00 GMT+0300 (Eastern European Summer Time)"

This is the way the Date object is behaving in the browser and because the Ignite UI editors are using the JavaScript Date object internally, the same is valid for them.

Here you can see the following paragraph Local observations and search if you are going to find specifics for the country you are currently located.

However the last question is not related directly to that. Let me share some observations beforehand.

I've changed your sample I little bit. Please see the attached file.

First I'm creating the date on the server in UTC. On my machine (server-side), which is +03:00, I create UTC date, and it ignores server time zone. This is recommended – to create, transfer date in UTC format, and only show local date or specific date with defined offset on client browsers.

viewModel.FirstDate = new DateTime(2018, 6, 13, 0, 0, 0, DateTimeKind.Utc);

viewModel.SecondDate = new DateTime(1976, 6, 13, 0, 0, 0, DateTimeKind.Utc);

So we created the date in UTC format, and editor wrapper will send it as UTC also. You can see this if you examine the script tag rendered just after the HTML input in the browser.

You can do one thing more – to set enableUtcDate of the editor to true, this will also ensure that client-side editor will save the date and send it back to the server in UTC format. As I said this is recommended and in this case is not related to the way date is displayed in the editor itself. 

However I've also set the displayTimeOffset to 0, so that I see UTC time in the editors. Of course in your case you can set it to 120, or leave it undefined and any client-side browser will show it according to their time zone.

You can see that in that case both dates 1976 and 2018 are showing same dates.

Everything now is in UTC but if you submit a new date, then on the server it arrives with some offset inside the TestSubmit method. And this is because MVC is receiving the date in UTC, but taking into account server-side offset it automatically transforms it. Here there is StackOverflow post about this, which says that you need to manually convert to Universal Time, the date that MVC has modified. Please see the attached sample and I will wait for your feedback. 

Best regards,

Nikolay Alipiev

Software Developer

7607.igGrid_5F00_DateTime_5F00_Submit.zip

0
Nikolay Alipiev
Nikolay Alipiev answered on Dec 20, 2017 12:36 PM

Hi, Shwetha.

I hope that I will be able to help you with my answer.

If you set the option displayTimeOffset to 0 then display value will be UTC, no matter what is browser time:

$("#dateEditor").igDateEditor({
   value: "2015-09-07T18:30:00.000Z",
   dateInputFormat: "dateTime",
   displayTimeOffset: 0
  });

As far as about the value method, we have designed the date editor to return always the value the browser is using – the one that it is automatically reverted. So you it is normal to see it that way. In order to get the UTC time just use the JavaScript methods to get UTC date – like for the hours – getUTCHours.

var browserDate = $("#DatesScheduledShipDateValue").igDatePicker('value');

var UTCHours = browserDate.getUTCHours().

If you have further questions, don't hesitate to ask!

Best regards,

Nikolay Alipiev

Software Developer