diff options
Diffstat (limited to 'app/lib/utils.ts')
| -rw-r--r-- | app/lib/utils.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/lib/utils.ts b/app/lib/utils.ts new file mode 100644 index 0000000..961aa31 --- /dev/null +++ b/app/lib/utils.ts @@ -0,0 +1,7 @@ +export function formatDuration(months: number): string { + const years = Math.floor(months / 12); + const m = months % 12; + if (years === 0) return `${m}ヶ月`; + if (m === 0) return `${years}年`; + return `${years}年${m}ヶ月`; +} |
