Skip to content

time: Add IsNull() function for Time struct #28351

@b-s-a

Description

@b-s-a

Current Time structure has no method like IsNull() (Valid() or something else) so you need to use t.Equal(time.Time{}) or pointers to check is time defined or not (for example, when you aquire values from external sources and some of them may be omited). Usage of pointers for such small object has known overhead, so I propose to add function IsNull() which returns true for uninitialized time structure (1970-01-01 00:00:00).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions