Skip to content

proposal: time: Add time.Day constant  #56460

@mzattahri

Description

@mzattahri

This is a modest and self-explanatory proposal to add a time.Day constant to the time package.

To restate the obvious:

  • It's needed for the same reason all the other constants in the package exist;
  • It would improve the readability of a lot of code where the required precision for dates is a day (e.g. billing);
  • For new gophers, the omission is rather unexpected.

I personally see any downsides, and the one-liner needed seems worth it.

Github search for code mentioning "24 * time.Hour".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions