Flutter-Bounty-Hunters / static_shock

A static site generator for Dart.
MIT License
59 stars 5 forks source link

[Shock] - Add a date time format filter #90

Closed matthew-carroll closed 2 months ago

matthew-carroll commented 2 months ago

Add a Jinja template filter that takes a date-time string and formats it to a different date-time string.

For example, given "2024-02-15", the filter might convert it to "Feb 15, 2024". The filter should use the standard Dart date-time format.

The default incoming format should be "yyyy-MM-dd". Given the default incoming format, the filter can be used with just the outgoing format: {{ date | formatDateTime(to = "MMM dd, yyyy") }}.

If the incoming format is different, that format can be specified, too: {{ date | formatDateTime(from = "MM-dd-yyyy", to = "MMM dd, yyyy") }}