Type conversion in template syntax

  1. uses pongo2 template engine and django template syntax is similar
  2. the start_time in the database is the UTC time, for example: 2017-12-05T02:41:19Z
  3. The
  4. service converts all the key-value pair data into json, and then passes them to the template engine
  5. .
  6. expect the format of the front end display is 2017-12-05 02:41
  7. the current template is:
  8. time = {{StartTime | date: "Y"}
  9. error message:

    panic: [Error (where: filter:date) | Line 1 Col 22 near "date"] filter input     argument must be of type "time.Time"
  10. Replacing date with time in the
  11. template also reports the same error

so, is anyone familiar with template syntax? Can you change StartTime to time.Time () type
if the local time + 8 is solved

Apr.02,2021
Menu