Control Date formatting in view?

42 views
Skip to first unread message

Eric Pugh

unread,
Aug 10, 2020, 10:36:08 AM8/10/20
to Blacklight Development
My release_date field is formatted as "2007-12-15T00:00:00Z", and I'd like to convert that to just the "2007-12-15" format...   I felt like https://github.com/projectblacklight/blacklight/wiki/Configuring-and-Customizing-Blacklight#overriding-views-templates-and-partials was going to help, but I don't want to override everything, just the formatting.

Seems like:
config.add_index_field 'date_released', label: 'Date'
should take some sort of formatter:  parameter!

Thoughts?

Eric


Eric Pugh

unread,
Aug 10, 2020, 11:08:30 AM8/10/20
to Blacklight Development
I did figure out how to use a helper method, however it seems like date formatting would be pretty common desire? 

Amgad Alsisi

unread,
Jan 4, 2021, 7:11:55 AM1/4/21
to Blacklight Development
Hello,

Thanks for sharing the helper method you have developed. I also wanted to format the date in the same way you have done. However, I would like to mention that the link you have provided is not working and I would very much appreciate it if you can fix it.

Thanks 
Amgad

Erik Hatcher

unread,
Jan 4, 2021, 8:35:50 AM1/4/21
to blacklight-...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Blacklight Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blacklight-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blacklight-development/e0eb19fa-27d1-4bd8-9a34-10aed4045f73n%40googlegroups.com.

Justin Coyne

unread,
Jan 4, 2021, 8:51:19 AM1/4/21
to blacklight-...@googlegroups.com
I always prefer to do date formatting in the front end as this makes the document more cacheable. I typically use github's time-elements for this: https://github.com/github/time-elements

--
You received this message because you are subscribed to the Google Groups "Blacklight Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blacklight-develo...@googlegroups.com.

Amgad Alsisi

unread,
Jan 5, 2021, 5:38:00 AM1/5/21
to Blacklight Development
 I can access the file now. It tried it and it works.
Thanks.

Reply all
Reply to author
Forward
0 new messages