mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-11-15 04:18:34 +05:30
feat: convert-days-to-hours (time tools)
This commit is contained in:
parent
a23e53386b
commit
82b238ffe0
4 changed files with 7 additions and 5 deletions
|
|
@ -95,10 +95,11 @@ export default function ConvertDaysToHours({
|
|||
inputComponent={<ToolTextInput value={input} onChange={setInput} />}
|
||||
resultComponent={<ToolTextResult value={result} />}
|
||||
initialValues={initialValues}
|
||||
exampleCards={exampleCards}
|
||||
getGroups={getGroups}
|
||||
setInput={setInput}
|
||||
compute={compute}
|
||||
toolInfo={{ title: `What is a ${title}?`, description: longDescription }}
|
||||
exampleCards={exampleCards}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ export const tool = defineTool('time', {
|
|||
path: 'convert-days-to-hours',
|
||||
name: 'Convert Days to Hours',
|
||||
icon: 'ri:24-hours-line',
|
||||
description: 'A tool to convert days into hours.',
|
||||
description:
|
||||
'With this browser-based application, you can calculate how many hours there are in the given number of days. The application takes the input values (days), multiplies them by 24 and that converts them into hours. It supports both integer and decimal day values and it can convert multiple values at the same time.',
|
||||
shortDescription: 'Convert days to hours easily.',
|
||||
keywords: ['convert', 'days', 'hours'],
|
||||
longDescription:
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ function compute(input: string) {
|
|||
return '';
|
||||
}
|
||||
const days = parseFloat(input);
|
||||
const hours = days * 24;
|
||||
return hours;
|
||||
const hours = (days * 24).toFixed(6);
|
||||
return parseFloat(hours);
|
||||
}
|
||||
|
||||
export function convertDaysToHours(input: string, hoursFlag: boolean): string {
|
||||
|
|
|
|||
|
|
@ -44,5 +44,5 @@ export function reverseString(input: string): string {
|
|||
* @returns True if the input contains only digits, false otherwise.
|
||||
*/
|
||||
export function containsOnlyDigits(input: string): boolean {
|
||||
return /^\d+$/.test(input.trim());
|
||||
return /^-?\d+(\.\d+)?$/.test(input.trim());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue