fix(fe timeformatter): fixed timeformatter reference in tracklist and formatFromSeconds function
This commit is contained in:
parent
36d3deab44
commit
b5bbb55569
2 changed files with 9 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import {onMounted, ref, watch} from "vue";
|
||||
import draggable from "vuedraggable";
|
||||
import {timeFormatter} from "../../../helpers/TimeFormatter.ts";
|
||||
import {timeFormatter} from "@/helpers/TimeFormatter.ts";
|
||||
|
||||
const emit = defineEmits([
|
||||
'updateTracks'
|
||||
|
|
|
@ -20,6 +20,11 @@ export function timeFormatter(time: String): string {
|
|||
}
|
||||
|
||||
export function formatFromSeconds(seconds: number): string {
|
||||
console.log(seconds)
|
||||
if (seconds.includes(':')) {
|
||||
let timeArray = seconds.split(':');
|
||||
seconds = (parseInt(timeArray[0])*3600)+(parseInt(timeArray[1])*60)+parseFloat(timeArray[2]);
|
||||
}
|
||||
let stringTime = '';
|
||||
let minutes = seconds / 60;
|
||||
let hours = minutes / 60;
|
||||
|
@ -35,9 +40,11 @@ export function formatFromSeconds(seconds: number): string {
|
|||
stringTime += (minutes < 10) ? '0' : '';
|
||||
stringTime += parseInt(minutes) + ':';
|
||||
seconds = seconds - (parseInt(minutes) * 60);
|
||||
seconds = seconds.toFixed(2);
|
||||
console.log(stringTime)
|
||||
}
|
||||
stringTime += seconds.toFixed(2);
|
||||
stringTime += (seconds < 10) ? '0' : '';
|
||||
stringTime += seconds;
|
||||
console.log(stringTime)
|
||||
return stringTime;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue