def generate_build_date()

in glean_parser/swift.py [0:0]


def generate_build_date(date: Optional[str]) -> str:
    """
    Generate the build timestamp.
    """

    ts = util.build_date(date)

    data = [
        ("year", ts.year),
        ("month", ts.month),
        ("day", ts.day),
        ("hour", ts.hour),
        ("minute", ts.minute),
        ("second", ts.second),
    ]

    # The internal DatetimeMetricType API can take a `DateComponents` object,
    # which lets us easily specify the timezone.
    components = ", ".join([f"{name}: {val}" for (name, val) in data])
    return f'DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), {components})'  # noqa