vue3-calendar-heatmap icon indicating copy to clipboard operation
vue3-calendar-heatmap copied to clipboard

endDate bug only shows 1969 year

Open Baut1 opened this issue 1 year ago • 2 comments

So basically even though i give the component the ":end-date" parameter it shows me the dates only between Dec 29, 1968 and Jan 3 1970.

<calendar-heatmap :end-date="2023-12-12" :values="[{ date: '1969-6-6', count: 6 }]" dark-mode/>

Is it possible this is a bug?

contribs

Baut1 avatar Dec 12 '23 22:12 Baut1

This happened because they have bad support for vue3, this happens for :values as well, there is two solution for this:

  1. :end-date="'2023-12-12'", string inside of variable
  2. create them as date, :end-date="new Date('2023-12-12')" ( I recommend this), I have found this answer after facing same problem.

omarhabeh avatar Jan 20 '24 23:01 omarhabeh

Yes, i ended up finding a solution using

<script setup lang="ts">
    const currentDate = new Date()
    const endDate = currentDate.toISOString().split('T')[0]
</script>
<template>
    <calendar-heatmap
        class="calendar"
        :end-date="endDate"
        ...
/>
</template>

Baut1 avatar Jan 21 '24 18:01 Baut1