When you provide a timestamp or JavaScript Date object, lightning:relativeDateTime displays a string that describes the relative time between the current time and the provided time. Sample code: Component: <aura:component implements = “force:appHostable”> <aura:attribute name=“pastDay” type=“Object”/> <aura:attribute name=“today9AM” type=“Object”/> <aura:attribute name=“now” type=“Object”/> <aura:attribute name=“futureday” type=“Object”/> <aura:handler name=“init” value=“{! this }” action=“{! c.init }” /> <div class=“slds-box slds-theme_default”> <div class=“slds-m-vertical_small”> Past Date: <strong><lightning:relativeDateTime value=“{! v.pastDay }”/></strong> </div> <div class=“slds-m-vertical_small”> Today 9:00 AM: <strong><lightning:relativeDateTime value=“{! v.today9AM }”/></strong> </div> <div class=“slds-m-vertical_small”> Right now: <strong><lightning:relativeDateTime value=“{! v.now }”/></strong> </div> <div class=“slds-m-vertical_small”> … Continue reading lightning:relativeDateTime
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed