semantic-duration-input
Vue 3 input component that parses human-friendly durations ("2h", "3 days", "1h30", "1:30", "PT1H") into minutes, seconds, ms or ISO 8601.
910
| Install | |
|---|---|
npm install semantic-duration-input |
|
| Latest Version: | 0.3.3 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 21, 2026 |
| Links: | GitHub · npm |
Maintainer: nicoalbrecht
semantic-duration-input
A Vue 3 input that understands human-friendly durations and gives you minutes (or seconds, milliseconds or ISO 8601) via v-model.
Documentation and live examples · npm
| You type | v-model |
|---|---|
2h |
120 |
3days |
4320 |
189h |
11340 (shown as 7d 21h after blur) |
1h 30m, 1h30m, 1h30, 1 hour and 30 minutes |
90 |
1.5h, 1,5 Std |
90 |
1:30 |
90 |
2 Stunden 15 Minuten |
135 |
PT1H30M |
90 |
Install
npm install semantic-duration-input
<script setup lang="ts">
import { ref } from 'vue'
import { DurationInput } from 'semantic-duration-input'
const minutes = ref<number | null>(90)
</script>
<template>
<DurationInput v-model="minutes" placeholder="e.g. 1h 30m" />
</template>
Then add the styles. With Tailwind v4:
@import 'tailwindcss';
@import 'semantic-duration-input/tailwind.css';
Without Tailwind:
import 'semantic-duration-input/style.css'
Features
- Syntax: units in English, German, Spanish, French, Portuguese, Hindi, Arabic and Chinese, compound values,
1h30, decimals,1:30, ISO 8601, and "did you mean" suggestions for typos. - Value formats: minutes, seconds, milliseconds, ISO 8601 strings or your own conversion.
- Behaviour: configurable validation timing, normalization on blur, keyboard stepping, presets menu, live preview.
- Locales: add languages or unit names with
defineLocale. - Custom units: units of your own (
2 sprints) and working time (1d= 8h). - Forms: native form submission,
validate(), anddurationSchema()for Standard Schema libraries. - Styling: Tailwind v4, themable through
--sdi-*tokens that fall back to shadcn-vue and Nuxt UI, classes per part,unstyled. - Integrations: render shadcn-vue, Nuxt UI, Vuetify, PrimeVue or any input through
as, or go renderless. - Nuxt module and headless core (
semantic-duration-input/core, no Vue needed).
AI coding agents
- Docs as Markdown: llms.txt (key facts and an index) and llms-full.txt (every page in one file). Each docs page is also available with
.mdappended to its URL. - Offline and version-matched: the npm package ships both files in
node_modules/semantic-duration-input/dist/. - Agent skill:
npx skills add nicoalbrecht/semantic-duration-inputinstalls a skill with setup recipes and the usual pitfalls. It's also in the npm package underskills/.
Upgrading from 0.1? See Migrating to 0.2 and the changelog.
Development
npm run dev # demo playground (with PrimeVue, Vuetify and shadcn-vue)
npm run docs:dev # documentation site
npm test # vitest
npm run typecheck # vue-tsc
npm run build # library build to dist/
npm run docs:build # documentation build to docs/.vitepress/dist
TypeScript is pinned to 6.x because TypeScript 7 no longer provides the JS compiler API that vue-tsc and vite-plugin-dts need.
License
Related Packages
@thespielplatz/tsp-tools-theme
tsp.tools design-system theme as a Nuxt layer (Nuxt UI v4 + Tailwind v4): amber-...
3,240
uniplatforms-ui
Vue 3 yoki Nuxt 4 uchun tayyor proyekt shabloni (TypeScript, TailwindCSS, Pinia,...
932
nuxt-ui-formwerk
Formwerk-powered form components for Nuxt UI: schema validation, field-level sta...
5,392
5
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.3.3 | ^3.5.0 | MIT | |
| 0.3.2 | ^3.5.0 | MIT | |
| 0.3.1 | ^3.5.0 | MIT | |
| 0.3.0 | ^3.5.0 | MIT | |
| 0.2.1 | ^3.5.0 | MIT |