This project is made to convert seconds to minutes or hours or days so that we can convert time much more easily.
You can do this time conversion in React JS or Vue JS projects and even in raw JavaScript, and there are no restrictions.
The timeFormatChanger(secondsValue, language)
function takes two inputs. In the first entry, you must enter the amount of time in seconds of the number type, and in the second entry, which is optional, you must select the written language of the numbers.
HTML page:
<body>
<h1></h1>
<script src='./app.js' type='module'></script>
</body>
JS page:
import timeFormatChanger from './Time.js'
Or
import { timeFormatChanger } from './Time.js'
document.querySelector('h1').innerHTML = timeFormatChanger(100000, 'en-US') // Result: 01:03:46:40
document.querySelector('h1').innerHTML = timeFormatChanger(100000) // Result: 01:03:46:40
document.querySelector('h1').innerHTML = timeFormatChanger(9129, 'fa-IR') // Result: ۰۲:۳۲:۰۹
JSX page:
import timeFormatChanger from './Time.js'
Or
import { timeFormatChanger } from './Time.js'
export default function App() {
return (
<>
<h1> { timeFormatChanger(100000, 'en-US') } </h1> // Result: 01:03:46:40
<h1> { timeFormatChanger(100000) } </h1> // Result: 01:03:46:40
<h1> { timeFormatChanger(9129, 'fa-IR') } </h1> // Result: ۰۲:۳۲:۰۹
</>
)
}
vue page:
<template>
<div>
<h1>{{ timeFormatChanger(100000, 'en-US') }}</h1> // Result: 01:03:46:40
<h1>{{ timeFormatChanger(100000) }}</h1> // Result: 01:03:46:40
<h1>{{ timeFormatChanger(9129, 'fa-IR') }}</h1> // Result: ۰۲:۳۲:۰۹
</div>
</template>
<script>
import timeFormatChanger from './Time.js';
Or
import { timeFormatChanger } from './Time.js';
export default {
name: 'App',
methods: {
timeFormatChanger,
},
};
</script>