mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-09 16:52:17 +01:00
fix duration formatting over 24h, fix time entry create modal clearing after submit
This commit is contained in:
@@ -30,12 +30,12 @@ const timeEntryDefaultValues = {
|
||||
user_id: getCurrentUserId(),
|
||||
};
|
||||
|
||||
const timeEntry = ref(timeEntryDefaultValues);
|
||||
const timeEntry = ref({ ...timeEntryDefaultValues });
|
||||
|
||||
async function submit() {
|
||||
await createTimeEntry(timeEntry.value);
|
||||
timeEntry.value = { ...timeEntryDefaultValues };
|
||||
show.value = false;
|
||||
timeEntry.value = timeEntryDefaultValues;
|
||||
}
|
||||
|
||||
const projectNameInput = ref<HTMLInputElement | null>(null);
|
||||
|
||||
@@ -19,7 +19,10 @@ export function getDayJsInstance() {
|
||||
}
|
||||
|
||||
export function formatHumanReadableDuration(duration: number): string {
|
||||
return dayjs.duration(duration, 's').format('HH[h] mm[min]');
|
||||
const dayJsDuration = dayjs.duration(duration, 's');
|
||||
const hours = dayJsDuration.hours() + dayJsDuration.days() * 24;
|
||||
const minutes = dayJsDuration.minutes();
|
||||
return `${hours}h ${minutes.toString().padStart(2, '0')}min`;
|
||||
}
|
||||
|
||||
export function calculateDifference(start: string, end: string | null) {
|
||||
|
||||
Reference in New Issue
Block a user