2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix: for loop keys, buggy toValue

This commit is contained in:
18alantom 2022-07-27 05:48:10 -07:00
parent e76e67ceea
commit c0c3046c20

View File

@ -63,11 +63,11 @@
{{ d }} {{ d }}
</div> </div>
</div> </div>
<div v-for="(week, i) in datesAsWeeks" :key="i" class="mt-1"> <div v-for="(week, i) in datesAsWeeks" :key="`${i}-${Math.random().toString(36)}`" class="mt-1">
<div class="flex w-full"> <div class="flex w-full">
<div <div
v-for="date in week" v-for="date in week"
:key="toValue(date)" :key="`${toValue(date)}-${Math.random().toString(36)}`"
class=" class="
w-6 w-6
h-6 h-6
@ -118,6 +118,7 @@
</template> </template>
<script> <script>
import { DateTime } from 'luxon';
import Popover from '../Popover'; import Popover from '../Popover';
export default { export default {
@ -255,14 +256,7 @@ export default {
return ''; return '';
} }
// toISOString is buggy and reduces the day by one return DateTime.fromJSDate(date).toISODate()
// this is because it considers the UTC timestamp
// in order to circumvent that we need to use luxon/moment
// but that refactor could take some time, so fixing the time difference
// as suggested in this answer.
// https://stackoverflow.com/a/16084846/3541205
date.setHours(0, -date.getTimezoneOffset(), 0, 0);
return date.toISOString().slice(0, 10);
}, },
getDate(...args) { getDate(...args) {