summaryrefslogtreecommitdiff
path: root/app/lib/utils.ts
diff options
context:
space:
mode:
authoryyamashita <yyamashita@mosquit.one>2026-05-10 22:46:59 +0900
committeryyamashita <yyamashita@mosquit.one>2026-05-10 22:46:59 +0900
commitec2417fc3e7029cb6fa84aa184daac2768ddad85 (patch)
tree3d4b0d8ad3b90d3bb99f9c2932637f756090b57a /app/lib/utils.ts
parent184e6947707ecdf07dfa3a5cbc6e51cf9440e93a (diff)
Separate current/former members with calculable period dates
- Add MemberGroup/BandGroup types and groupBandMembers/groupArtistMembers helpers - Calculate membership duration in months from YYYY-MM since/until values - Band view splits members into 在籍中 / 元メンバー sections with duration label - Artist view splits bands into 在籍中 / 元在籍 sections with duration label - Change since/until inputs to type="month" for structured data entry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/lib/utils.ts')
-rw-r--r--app/lib/utils.ts7
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}ヶ月`;
+}