From 1b02e4f0149cb5223ad650be212d3193cd5e362a Mon Sep 17 00:00:00 2001 From: Dirk Raeder Date: Mon, 22 Oct 2012 10:55:54 +0200 Subject: [PATCH] fixes #3 by adding a format_date plugin method --- plugins/Templaters/db6edr_formatting_helper.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/Templaters/db6edr_formatting_helper.rb diff --git a/plugins/Templaters/db6edr_formatting_helper.rb b/plugins/Templaters/db6edr_formatting_helper.rb new file mode 100644 index 0000000..a7e6fbf --- /dev/null +++ b/plugins/Templaters/db6edr_formatting_helper.rb @@ -0,0 +1,15 @@ +class Ruhoh + module Templaters + module BaseHelpers + + # Render date in the format given in the date_format variable in config + def format_date(date) + newDate = DateTime.parse(date) + strftimeString=self.context['site']['config']['date_format'] + strftimeString ||="%F" + newDate.strftime(strftimeString) + end + end + end +end + \ No newline at end of file