Skip to content

Padding months, days, and hours #3

@Fastidious

Description

@Fastidious

How do I go about adding padding to months, days, and hours? I figure it is on view.oak, in here:

fn date(t) {
        d := datetime.describe(t)
        '<a class="datestamp" href="/on/{{0}}/{{1}}/{{2}}" title="Updates on this date">{{0}}/{{1}}/{{2}}</a>
        <a class="clockstamp" href="/updates/{{5}}" title="Permalink to this update">{{3}}:{{4}}</a>' |> format(
                d.year
                d.month
                d.day
                d.hour
                d.minute |> string() |> padStart(2, '0')
                t
        )
}

I tried adding |> string() |> padStart(2, '0’) after d.month, d.day, and so on, just like d.minute has, but that didn’t work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions