sentDate + date-fns format

This commit is contained in:
Jeffrey Biles
2020-03-17 13:32:21 -07:00
parent 98c669b139
commit e2498155c5
4 changed files with 15 additions and 1 deletions

View File

@@ -12,6 +12,9 @@ new Server({
}, },
body(){ body(){
return faker.lorem.sentence() return faker.lorem.sentence()
},
sentDate(){
return faker.date.recent(20)
} }
}) })
}, },
@@ -21,6 +24,6 @@ new Server({
routes() { routes() {
this.namespace = 'api'; this.namespace = 'api';
this.get('/emails', {timing: 2000}); this.get('/emails');
} }
}) })

View File

@@ -9,6 +9,7 @@
}, },
"dependencies": { "dependencies": {
"core-js": "^3.6.4", "core-js": "^3.6.4",
"date-fns": "^2.11.0",
"vue": "^3.0.0-alpha.9" "vue": "^3.0.0-alpha.9"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -8,13 +8,18 @@
<td><input type="checkbox" /></td> <td><input type="checkbox" /></td>
<td>{{email.subject}}</td> <td>{{email.subject}}</td>
<td>{{email.body}}</td> <td>{{email.body}}</td>
<td>{{format(new Date(email.sentDate), 'HH:MM MMM do yyyy')}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</template> </template>
<script> <script>
import { format } from 'date-fns'
export default { export default {
setup(){
return {format}
},
props: { props: {
emails: { emails: {
type: Array, type: Array,

View File

@@ -2628,6 +2628,11 @@ dashdash@^1.12.0:
dependencies: dependencies:
assert-plus "^1.0.0" assert-plus "^1.0.0"
date-fns@^2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.11.0.tgz#ec2b44977465b9dcb370021d5e6c019b19f36d06"
integrity sha512-8P1cDi8ebZyDxUyUprBXwidoEtiQAawYPGvpfb+Dg0G6JrQ+VozwOmm91xYC0vAv1+0VmLehEPb+isg4BGUFfA==
de-indent@^1.0.2: de-indent@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"