mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Use iSameDate
This commit is contained in:
parent
7ad74b1398
commit
a7fc5536c5
@ -32,7 +32,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { format } from 'date-fns'
|
import { format, isSameDay } from 'date-fns'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DateRange',
|
name: 'DateRange',
|
||||||
@ -65,16 +65,8 @@ export default {
|
|||||||
return this.endDate ? new Date(this.endDate) : null
|
return this.endDate ? new Date(this.endDate) : null
|
||||||
},
|
},
|
||||||
isSameDateButMayHaveTimeDifference() {
|
isSameDateButMayHaveTimeDifference() {
|
||||||
return (
|
return !this.endDateAsDate || isSameDay(this.endDateAsDate, this.startDateAsDate)
|
||||||
!this.endDateAsDate ||
|
|
||||||
(this.endDateAsDate.getYear() === this.startDateAsDate.getYear() &&
|
|
||||||
this.endDateAsDate.getMonth() === this.startDateAsDate.getMonth() &&
|
|
||||||
this.endDateAsDate.getDay() === this.startDateAsDate.getDay())
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
// isSameYear() {
|
|
||||||
// return this.isSameDate || (!this.endDateAsDate || this.endDateAsDate.getYear() === this.startDateAsDate.getYear())
|
|
||||||
// },
|
|
||||||
getStartDateString() {
|
getStartDateString() {
|
||||||
const isSameYear =
|
const isSameYear =
|
||||||
this.isSameDateButMayHaveTimeDifference ||
|
this.isSameDateButMayHaveTimeDifference ||
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user