PHP Classes

File: resources/js/Components/DaysSince.vue

Recommend this page to a friend!
  Classes of Robert Devenyi   Iceburg SAAS PHP CRM Open Source   resources/js/Components/DaysSince.vue   Download  
File: resources/js/Components/DaysSince.vue
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Iceburg SAAS PHP CRM Open Source
Application to manage the contacts of customers
Author: By
Last change:
Date: 1 year ago
Size: 632 bytes
 

Contents

Class file image Download
<template> <div> <p v-if="daysSince == 0">Expiring tonight</p> <p v-else-if="daysSince <= 1">{{ daysSince }} day left</p> <p v-else>{{ daysSince }} days left</p> </div> </template> <script> import { computed } from 'vue'; export default { props: { date: { type: Date, required: true, }, }, setup(props) { const today = new Date(); const daysSince = computed(() => 7 - Math.floor((today - new Date(props.date)) / (1000 * 60 * 60 * 24)) ); return { daysSince, }; }, }; </script>