Let's say I have a current date filtered to February 22nd 2019
. I want the nd
sign to be inside the <sup class="small"></sup>
tag. The problem is, I'm using Vue and Moment.js at the same time.
In PHP, I could just do:
{!! Carbon\Carbon::today()->format('F d<\s\up \c\l\a\s\s\="\s\m\a\l\l\"\>S</\s\up> Y') !!}
but how can I do that in Javascript and Vue? Or maybe there is cleaner way to do so? Please take a look at my script..
<template>
<div class="container">
<!-- Textbox -->
<div class="textbox text-white">
<p>Realtime Flight Schedule</p>
<div class="live-datetime">
<h1>{{ currentDate | filterCurrentDate }}</h1>
<digi-clock></digi-clock>
</div>
</div>
<!-- Flight table -->
<flight-table></flight-table>
</div>
</template>
<script>
import moment from 'moment'
export default {
filters: {
filterCurrentDate(date) {
return moment(date).format("MMMMM Do Y")
}
},
data() {
return {
currentDate: new Date(),
}
},
}
</script>