Skip to content

Commit

Permalink
Fix dates parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien LeBlanc committed Oct 23, 2023
1 parent 78dcbc2 commit cd1040b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/components/TimeEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<label>{{ $t('Description') }}</label>
<textarea
v-model="model.description"
class="form-control form-input-bordered form-input block h-auto w-full py-3 [form-sizing:content]"
class="form-control form-input-bordered form-input block h-auto w-full py-3 [field-sizing:content]"
rows="2"
:placeholder="`${$t('Description')}...`"
></textarea>
Expand Down Expand Up @@ -241,7 +241,7 @@ const computedDate = computed(() => {
const computedDuration = computed({
get() {
const date = !model.value.is_live_clocking ? computedDate.value : new Date().toLocaleDateString('en-CA');
const date = !model.value.is_live_clocking ? computedDate.value : $moment().format('YYYY-MM-DD');
const start = $moment(computedDate.value + ' ' + model.value.start_time, 'YYYY-M-D HH:mm');
const end = (model.value.end_time !== '00:00' ? $moment(date) : $moment(date).add(1, 'day')).set({
hours: parseInt(model.value.end_time.split(':')[0]),
Expand Down Expand Up @@ -321,8 +321,6 @@ const has_gap = computed(() => {
.duration($moment(model.value.start_time, 'HH:mm').diff($moment(previousEntry.value.end_time, 'HH:mm')))
.format('HH:mm', { trim: false });
return hasGap ? gapDuration : false;
return;
}
return false;
});
Expand All @@ -336,7 +334,7 @@ const end_time_error = computed(() => {
});
const duration_error = computed(() => {
const date = !model.value.is_live_clocking ? computedDate.value : new Date().toLocaleDateString('en-CA');
const date = !model.value.is_live_clocking ? computedDate.value : $moment().format('YYYY-MM-DD');
const start = $moment(computedDate.value + ' ' + model.value.start_time, 'YYYY-M-D HH:mm');
const end = (model.value.end_time !== '00:00' ? $moment(date) : $moment(date).add(1, 'day')).set({
hours: parseInt(model.value.end_time.split(':')[0]),
Expand Down
2 changes: 1 addition & 1 deletion src/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useIndexStore = defineStore('store', () => {
},
};

const selectedDay = ref(new Date().toLocaleDateString('en-CA'));
const selectedDay = ref($moment().format('YYYY-MM-DD'));
const filter = useLocalStorage('filter', ref('daily'));
const selectedTabIndex = useLocalStorage('selectedTabIndex', ref(0));
const sort = useLocalStorage('sort', ref('name'));
Expand Down

0 comments on commit cd1040b

Please sign in to comment.