Repository navigation
Template functions for dates and times - #27
Merged
Merged
Conversation
Ported from OwlShack. date formats a time.Time or the wire's unix seconds in a Go layout, optionally in a named IANA zone; zero stays zero rather than becoming 1970. time/tzdata is embedded so named zones resolve on every release target, and a test guards the import.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #25. Ports OwlShack's
nowanddatetemplate functions.{{date now "15:04"}},{{date now "Mon 2 Jan, 3:04PM" "Pacific/Auckland"}},{{now.Year}}.{{date .Timestamp "15:04"}}renders a channel message's wire timestamp (uint32 unix seconds), which is what the issue asked for. Zero renders as year 0001, not 1970.time/tzdatais embedded so a named zone resolves on Windows and minimal containers;TestEmbeddedTZDataIsLinkedguards the import.*time.Timecase is left out (it exists for its RSS feed items).Testing: OwlShack's seven tests, ported. Mutation-checked: dropping the tzdata import and ignoring the zone argument each fail them. Full suite under
-race. Not run on air.The optional
formatPathBytesseparator follows in a separate PR.