← Back
"""
Time utilities — Vancouver timezone helpers.
"""

from datetime import datetime, timezone, timedelta

VANCOUVER_TZ = timezone(timedelta(hours=-7))


def now_vancouver() -> datetime:
    """Current time in Vancouver."""
    return datetime.now(VANCOUVER_TZ)


def now_utc() -> datetime:
    """Current time in UTC."""
    return datetime.now(timezone.utc)


def format_duration(minutes: float) -> str:
    """Format minutes into human-readable duration."""
    if minutes < 60:
        return f"{minutes:.0f}min"
    hours = minutes / 60
    if hours < 24:
        return f"{hours:.1f}h"
    days = hours / 24
    return f"{days:.1f}d"