6

So I've wanted to change the default format of the date time field in the experience editor. I've had a look and most people suggest

@Editable(item,  x => x.Start_Date, x=>x.Start_Date.ToString("MMMM dd,yyyy"))

but the problem is that, it will only show the custom datetime format on the final page, but I want the custom format to be shown on the experience editor as well.

Is there anyway I can achieve this?

Thanks.

3

As far as I know this is not possible out of the box, but you can do the following as a workaround:

@using (Html.Glass().BeginEditFrame(Model, "Edit Date", x => x.Start_Date))
{
    Model.Start_Date.ToString("MMMM dd,yyyy")
}

Others maybe have a better solution.

| improve this answer | |
3

When text is rendered in the Experience Editor Glass passes back control for rendering to the Sitecore RenderField pipeline. This has to be done so that Sitecore can render the HTML required to make the field editable.

You will need to add a processor to the RenderField pipeline to handle this scenario.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.