pp icon indicating copy to clipboard operation
pp copied to clipboard

Option to format time.Time

Open dennypenta opened this issue 1 year ago • 1 comments

The problem: I have a struct with a bunch of populated fields. I want to print the struct in order to use it in my unit test as data input and not to describe it manually.

The library fits it well, but a few formatting options are missing.

The solution Add an optional formatting for fields like time.Time and may be the others, instead of raw string value I would like to see:

time.Date(1, 2, 3, 5, 6, 7, time.Local)

Any questions/concerns regarding the feature?

dennypenta avatar Dec 07 '23 13:12 dennypenta

The logic to format time.Date(1, 2, 3, 5, 6, 7, time.Local) is implemented by the user and not in the pp side, right? Then I'm open to merging a pull request that adds such a customization capability, assuming the patch would not be too complicated.

k0kubun avatar Dec 09 '23 07:12 k0kubun