2

I used template containing field from type DateTime and render time in Rendering Variant like that

enter image description here

When I enter date only in field and time is empty, it render default value 12:00 AM so I need to not render time when it is empty, As I remove check from "Render if empty" check box but it did not work and I tried to use Rules but also did not work so there are another way to do?

2
3

If you don't want to display time, but just a data simply change the Date format. Render if empty is to render field renderer in the Experience Editor even if the field doesn't have a value. Thanks to this, you will see "No text in field", and you will be able to fill it (in the Experience Editor).

If you would like to display date all the time but conditionally display time when it is provided together with a date you will need to write some custom code. This is not available out of the box. You can:

  • write your own Variant Token - take a look here
  • override RenderDate processor and dynamically change the date format - you can check if time is also provided and if so use date format which has time

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.