mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-25 23:24:09 +03:00
Merge branch 'feat/ttl-calc' into chore/all-my-stuffs
# Conflicts: # components.d.ts # src/tools/index.ts
This commit is contained in:
commit
107864bad0
4 files changed
+67
-1
No files matched your search
Generated
-1
@@ -15617,7 +15617,6 @@ packages:
|
|||||||
|
|
||||||
/yamljs@0.3.0:
|
/yamljs@0.3.0:
|
||||||
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
dependencies:
|
||||||
argparse: 1.0.10
|
argparse: 1.0.10
|
||||||
glob: 7.2.3
|
glob: 7.2.3
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ import { tool as rmbNumbers } from './rmb-numbers';
|
|||||||
import { tool as sensitiveDataMasker } from './sensitive-data-masker';
|
import { tool as sensitiveDataMasker } from './sensitive-data-masker';
|
||||||
import { tool as textToUnicodeNames } from './text-to-unicode-names';
|
import { tool as textToUnicodeNames } from './text-to-unicode-names';
|
||||||
import { tool as torrentToMagnet } from './torrent-to-magnet';
|
import { tool as torrentToMagnet } from './torrent-to-magnet';
|
||||||
|
import { tool as ttlCalculator } from './ttl-calculator';
|
||||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||||
@@ -366,6 +367,8 @@ export const toolsByCategory: ToolCategory[] = [
|
|||||||
dataTransferRateConverter,
|
dataTransferRateConverter,
|
||||||
dataStorageUnitConverter,
|
dataStorageUnitConverter,
|
||||||
],
|
],
|
||||||
|
ttlCalculator,
|
||||||
|
percentageCalculator],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Measurement',
|
name: 'Measurement',
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { CalendarTime } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'TTL calculator',
|
||||||
|
path: '/ttl-calculator',
|
||||||
|
description: 'TTL to Time converter',
|
||||||
|
keywords: ['ttl', 'dns', 'calculator', 'time', 'live', 'duration'],
|
||||||
|
component: () => import('./ttl-calculator.vue'),
|
||||||
|
icon: CalendarTime,
|
||||||
|
createdAt: new Date('2024-04-20'),
|
||||||
|
});
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { formatDuration, intervalToDuration } from 'date-fns';
|
||||||
|
import SpanCopyable from '@/components/SpanCopyable.vue';
|
||||||
|
|
||||||
|
const days = ref(0);
|
||||||
|
const hours = ref(24);
|
||||||
|
const minutes = ref(0);
|
||||||
|
const seconds = ref(0);
|
||||||
|
const ttlDisplay = computed(() => (days.value * 86400 + hours.value * 3600 + minutes.value * 60 + seconds.value).toString());
|
||||||
|
|
||||||
|
const ttl = ref(0);
|
||||||
|
const timeDisplay = computed(() => formatDuration(intervalToDuration({ start: 0, end: ttl.value * 1000 })));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<c-card title="Time to TTL" mb-3>
|
||||||
|
<n-space>
|
||||||
|
<n-form-item label="Days">
|
||||||
|
<n-input-number v-model:value="days" :min="0" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Hours">
|
||||||
|
<n-input-number v-model:value="hours" :min="0" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Minutes">
|
||||||
|
<n-input-number v-model:value="minutes" :min="0" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="Seconds">
|
||||||
|
<n-input-number v-model:value="seconds" :min="0" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<n-form-item label="TTL:" label-placement="left">
|
||||||
|
<SpanCopyable :value="ttlDisplay" />
|
||||||
|
</n-form-item>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<c-card title="TTL to Time">
|
||||||
|
<n-form-item label="TTL">
|
||||||
|
<n-input-number v-model:value="ttl" :min="0" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<n-form-item label="Time">
|
||||||
|
<SpanCopyable :value="timeDisplay" />
|
||||||
|
</n-form-item>
|
||||||
|
</c-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in new issue
Block a user