SXA : Custom Date Format using Rendering Variant tool
In this blog I will show you how to apply a custom date format in Rendering Variant using the
Rendering Variant tool that implements NVelocity templates.
For example if you have event page which inherent from Page template and you have "FromDate"and "ToDate" fields
If we need to display date as below format
You need to create a variant under Page content let give it name "Event Details"
this variant will have "From Date" and " To Date" as VariantDateField
Note that the options for date format is limited by what we have in the foundation
/sitecore/system/Settings/Foundation/Experience Accelerator/Rendering Variants/Enums/Date Formats
SXA provided date format tool we can use it inside the "Variant Template"
so we add "Custom Date" from Template as below
and set custom Template value
and the now if you select the Event Details variant,the new date format will applied
Rendering Variant tool that implements NVelocity templates.
For example if you have event page which inherent from Page template and you have "FromDate"and "ToDate" fields
If we need to display date as below format
You need to create a variant under Page content let give it name "Event Details"
this variant will have "From Date" and " To Date" as VariantDateField
Note that the options for date format is limited by what we have in the foundation
/sitecore/system/Settings/Foundation/Experience Accelerator/Rendering Variants/Enums/Date Formats
SXA provided date format tool we can use it inside the "Variant Template"
so we add "Custom Date" from Template as below
and set custom Template value
and the now if you select the Event Details variant,the new date format will applied
Comments
Post a Comment