mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 21:36:41 +02:00
feat: unify utilities into shared packages (Tier 1)
- Add LanguageSelector component to @manacore/shared-i18n - Add keyboard.ts to @manacore/shared-utils (shortcuts handling) - Add cache.ts to @manacore/shared-utils (IndexedDB caching) - Extend format.ts and date.ts with additional utilities - Update Memoro to use shared utilities with app-specific wrappers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7d426d57fd
commit
74ccad38d5
15 changed files with 877 additions and 647 deletions
|
|
@ -150,3 +150,29 @@ export function formatPercent(
|
|||
maximumFractionDigits: decimals,
|
||||
}).format(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format duration as compact string (alias for formatDuration)
|
||||
* Kept for compatibility - returns MM:SS or HH:MM:SS
|
||||
*/
|
||||
export const formatDurationCompact = formatDuration;
|
||||
|
||||
/**
|
||||
* Parse duration string to seconds
|
||||
*
|
||||
* @param duration - Duration string (e.g., "1:30" or "1:01:05")
|
||||
* @returns Duration in seconds
|
||||
*/
|
||||
export function parseDuration(duration: string): number {
|
||||
const parts = duration.split(':').map(Number);
|
||||
|
||||
if (parts.length === 3) {
|
||||
// Hours:Minutes:Seconds
|
||||
return parts[0] * 3600 + parts[1] * 60 + parts[2];
|
||||
} else if (parts.length === 2) {
|
||||
// Minutes:Seconds
|
||||
return parts[0] * 60 + parts[1];
|
||||
}
|
||||
|
||||
return parts[0] || 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue