From b7ab7309e59c8c5256234ecdba6532b80cc417b0 Mon Sep 17 00:00:00 2001
From: Tom Wiesing <tkw01536@gmail.com>
Date: Fri, 23 Jun 2017 15:03:33 -0400
Subject: [PATCH] Proper date formatting

---
 _includes/date.html          | 34 ++++++++++++++++++++++++++++++++++
 _includes/people_list.html   | 10 ++++++++--
 _includes/projects_list.html | 18 ++++++++++++------
 _layouts/project.html        | 10 +++++++++-
 _layouts/system.html         | 10 +++++++++-
 5 files changed, 72 insertions(+), 10 deletions(-)
 create mode 100644 _includes/date.html

diff --git a/_includes/date.html b/_includes/date.html
new file mode 100644
index 0000000..7bd201e
--- /dev/null
+++ b/_includes/date.html
@@ -0,0 +1,34 @@
+{% comment %}
+    Properly formats the date in yyyy[-mm] format. 
+    Expects 'date' to be formatted as an argument. 
+{% endcomment %}
+{% assign dateparts = date | split: "-" %}
+{% assign year = dateparts[0] %}
+{% assign month = dateparts[1] %}
+
+{% if month == '01' %}
+January
+{% elsif month == '02' %}
+February
+{% elsif month == '03' %}
+March
+{% elsif month == '04' %}
+April
+{% elsif month == '05' %}
+May
+{% elsif month == '06' %}
+June
+{% elsif month == '07' %}
+July
+{% elsif month == '08' %}
+August
+{% elsif month == '09' %}
+September
+{% elsif month == '10' %}
+October
+{% elsif month == '11' %}
+November
+{% elsif month == '12' %}
+December
+{% endif %}
+{{year}}
\ No newline at end of file
diff --git a/_includes/people_list.html b/_includes/people_list.html
index 2ec3c12..6fe409c 100644
--- a/_includes/people_list.html
+++ b/_includes/people_list.html
@@ -15,10 +15,16 @@
                     <a href="{{person.url}}" class="title">{{person.fullname}}</a>
                     <p>
                       {% if person.start_date %}
-                        from {{person.start_date}} <br/>
+                        from
+                        {% assign date = person.start_date %}
+                        {% include date.html %}
+                        <br/>
                       {% endif %}
                       {% if person.end_date %}
-                          until {{person.end_date}} <br/>
+                          until
+                          {% assign date = person.end_date %}
+                          {% include date.html %}
+                          <br/>
                       {% endif %}
                     </p>
                 </li>
diff --git a/_includes/projects_list.html b/_includes/projects_list.html
index 456e4c4..4aaa62e 100644
--- a/_includes/projects_list.html
+++ b/_includes/projects_list.html
@@ -13,12 +13,18 @@
                 <li class="collection-item avatar">
                   <a href="{{project.url}}" class="title">{{project.fullname}}</a>
                   <p>
-                    {% if project.start_date %}
-                        from {{project.start_date}} <br/>
-                    {% endif %}
-                    {% if project.end_date %}
-                        until {{project.end_date}} <br/>
-                    {% endif %}
+                      {% if project.start_date %}
+                        from
+                        {% assign date = project.start_date %}
+                        {% include date.html %}
+                        <br/>
+                      {% endif %}
+                      {% if project.end_date %}
+                          until
+                          {% assign date = project.end_date %}
+                          {% include date.html %}
+                          <br/>
+                      {% endif %}
                   </p>
                 </li>
             {% endfor %}
diff --git a/_layouts/project.html b/_layouts/project.html
index ca8aaae..c31e8de 100644
--- a/_layouts/project.html
+++ b/_layouts/project.html
@@ -18,7 +18,15 @@ layout: default
         
         {% if page.start %}
         <p>
-          <b>From:</b> {{page.start}} {% if page.end %} <b>To:</b> {{page.end}} {% endif %}
+          <b>From:</b>
+            {% assign date = page.start %}
+            {% include date.html %}
+            
+          {% if page.end %}
+            <b>To:</b>
+                {% assign date = page.end %}
+                {% include date.html %}
+          {% endif %}
         </p>
         {% endif %}
         
diff --git a/_layouts/system.html b/_layouts/system.html
index 19a226b..4a66897 100644
--- a/_layouts/system.html
+++ b/_layouts/system.html
@@ -17,7 +17,15 @@ layout: default
         
         {% if page.start %}
         <p>
-          <b>From:</b> {{page.start}} {% if page.end %} <b>To:</b> {{page.end}} {% endif %}
+          <b>From:</b>
+            {% assign date = page.start %}
+            {% include date.html %}
+            
+          {% if page.end %}
+            <b>To:</b>
+                {% assign date = page.end %}
+                {% include date.html %}
+          {% endif %}
         </p>
         {% endif %}
         
-- 
GitLab