Try our conversational search powered by Generative AI!

Date is not coming proper when using EditorDescriptionRegistration

Vote:
 

Hi All,

we are using below code to display dateTime calendar in CMS Edit mode.

[EditorDescriptorRegistration(TargetType = typeof(DateTime?), UIHint = "Datepicker")]
[EditorDescriptorRegistration(TargetType = typeof(DateTime), UIHint = "Datepicker")]
public class DateSelectorEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)
{
base.ModifyMetadata(metadata, attributes);
ClientEditingClass = "dijit/form/DateTextBox";
}

}




This is working fine on local system when i am seleting date from Edit mode but when we are deploying this code on upper environment then date is coming as last day date. For example, if i select date as 18-jan-2018 from EditMode but system is treating this date as 17-Jan-2018.

#187317
Jan 19, 2018 7:34
Vote:
 

Is this only happening with EditorDescriptionRegistration? Have you checked any other datetime properties rendered on the page? It sounds like it could be a confusion around timezones, since the time on the server doesn't have to be the same as on the client and the CMS UI will display the time in the timezone of the browser the editor is using - which doesn't have to be the same as what the server will render for a visitor on the site.

#187347
Jan 19, 2018 16:06
Vote:
 

You might want to check out this thread as well: https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2015/2/datetime-utc-offset/

#187356
Edited, Jan 19, 2018 16:57
Vote:
 

Hi John,

I checked for other datetime properties and they are working fine on server. It is not about timezone of server, i already verified that. However for my solution, i used other datetime property but wanted to know why it is not working with EditorDescriptionRegistration.

Thanks for your response.

#187358
Jan 19, 2018 18:17
Vote:
 

Good that it works for you. We havent seen it before and i tried to reproduce the problem but cant find anything for now

#187527
Jan 25, 2018 8:09
Vote:
 

Hi Arun, 

I am facing the same issue. Can you please eloborate like how you fixed this?

#256696
Jun 16, 2021 9:49
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.