lucasnevespereira / resumme-builder

Resume builder in Golang using json data and html templates
MIT License
15 stars 6 forks source link

feat: Add formatDate function to template functions #4

Closed francois07 closed 3 months ago

francois07 commented 3 months ago

This adds a new function to templates named formatDate that can be used the following way : {{ formatDate "Jan, 2006" "2024-07-03" }}. time.Parse() and time.Time.Format() are used to do this hence the peculiar way date format is specified (cf. https://pkg.go.dev/time#Parse and https://pkg.go.dev/time#Time.Format).

Note : It makes it necessary to specify dates in YYYY-MM-DD format. If this is an issue, the expected incoming format could be specified as an additional parameter by the template.

lucasnevespereira commented 3 months ago

Hello @francois07

Thank you for adding this functionality. An additional parameter for date formats is a great idea. For now, it will work. I'll either open an issue or add the parameter for date formats later.

I'll close this, since the code seems to be already included in your other Pull Request.

Thanks again for your contribution!