JavaScript field: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 48: Line 48:
Example of Format dates
Example of Format dates
<source lang="javascript">
<source lang="javascript">
moment(field('Date')).format('MMMMM Do YYYYY') //March 18th 2016
moment(field('Date')).format('MMMMM Do YYYYY') // March 18th 2016
moment(field('Date')).format('dddd') //Friday
moment(field('Date')).format('dddd') // Friday
moment(field('Date')).format('dddd [Escaped] YYYY') //Friday Escaped 2016
moment(field('Date')).format('dddd [Escaped] YYYY') // Friday Escaped 2016
moment(field('Date')).format('HH:mm') //14:55
moment(field('Date')).format('HH:mm') // 14:55
</source>
</source>


Example of Relative Time
Example of Relative Time
<source lang="javascript">
<source lang="javascript">
moment(field('Date')).fromNow() //11 minutes ago
moment(field('Date')).fromNow() // 11 minutes ago
moment(field('Date')).startOf('day').fromNow() //15 hours ago
moment(field('Date')).startOf('day').fromNow() // 15 hours ago
</source>
</source>


Example of Calendar Time
Example of Calendar Time
<source lang="javascript">
<source lang="javascript">
moment(field('Date')).calendar() //Today at 2:55 PM
moment(field('Date')).calendar() // Today at 2:55 PM
moment(field('Date')).add(1 , 'days').calendar() //Tomorrow at 2:55 PM
moment(field('Date')).add(1 , 'days').calendar() // Tomorrow at 2:55 PM
</source>
</source>