Format dates in Blog Posts gridfield based on user preferences

Instead of always formatting to DD/MM/YYYY as Nice() does, format
the date based on user settings, using FormatFromSettings().

Fixes silverstripe/silverstripe-blog#384
This commit is contained in:
Ian Walls 2016-03-04 14:31:22 -05:00
parent 84efcf126b
commit 86f5295175

View File

@ -34,7 +34,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
'<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}', '<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}',
'State for when a post is saved.', 'State for when a post is saved.',
array( array(
'date' => $lastEdited->Nice(), 'date' => $lastEdited->FormatFromSettings(),
) )
); );
} }
@ -50,7 +50,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
'<i class="gridfield-icon blog-icon-timer"></i> Publish at {date}', '<i class="gridfield-icon blog-icon-timer"></i> Publish at {date}',
'State for when a post is published.', 'State for when a post is published.',
array( array(
'date' => $publishDate->Nice(), 'date' => $publishDate->FormatFromSettings(),
) )
) . $modifiedLabel; ) . $modifiedLabel;
} }
@ -60,7 +60,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
'<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}', '<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}',
'State for when a post is published.', 'State for when a post is published.',
array( array(
'date' => $publishDate->Nice(), 'date' => $publishDate->FormatFromSettings(),
) )
) . $modifiedLabel; ) . $modifiedLabel;
} }