2
0
mirror of https://github.com/frappe/books.git synced 2025-01-08 01:14:39 +00:00

fix: return local date for display

This commit is contained in:
18alantom 2023-07-18 14:22:40 +05:30
parent 3071040f8d
commit ccf609cbd7

View File

@ -46,6 +46,7 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { DateTime } from 'luxon';
import { fyo } from 'src/initFyo'; import { fyo } from 'src/initFyo';
import { defineComponent, nextTick } from 'vue'; import { defineComponent, nextTick } from 'vue';
import Base from './Base.vue'; import Base from './Base.vue';
@ -66,7 +67,7 @@ export default defineComponent({
} }
if (value instanceof Date && !Number.isNaN(value.valueOf())) { if (value instanceof Date && !Number.isNaN(value.valueOf())) {
return value.toISOString().split('T')[0]; return DateTime.fromJSDate(value).toISODate();
} }
return ''; return '';
@ -115,8 +116,6 @@ export default defineComponent({
this.showInput = false; this.showInput = false;
let value: Date | null = new Date(target.value); let value: Date | null = new Date(target.value);
value.setHours(0, 0, 0, 0);
if (Number.isNaN(value.valueOf())) { if (Number.isNaN(value.valueOf())) {
value = null; value = null;
} }