Skip to content

datetime doesn't allow rendering of future dates #2057

@Peefy

Description

@Peefy

Discussed in kcl-lang/community#25

Originally posted by blut January 27, 2026
At the moment all datetime function relate to the current time.

I was trying to render a step-wise iteration of a token expiration date but did not find a way to implement this with datetime.

Logically:

_expireAt = current?.expireAt or ""
if _expireAt == "" or float(_expireAt) < datetime.ticks() + 60 * 60 * 24 * 3:
    _expireAt = str(datetime.ticks() + 60 * 60 * 24 * 15)

-> render into %Y-%m-%d

And the last step was the one I had issues with.

Instead I created a schema and a epoch -> date object

Metadata

Metadata

Assignees

No one assigned

    Labels

    runtimeIssues or PRs related to kcl runtime including value and value opertions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions