Created
January 10, 2016 14:55
-
-
Save oojikoo-gist/2788ba25e08625504e0a to your computer and use it in GitHub Desktop.
rails: local_time patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
currently created a helper method to extract the core date from the string returned by the gem's local_date method | |
in views/ | |
<%= extract_date(local_date(workflow.created_at, CommonConstants::DATE_FORMAT_LONG)) %> | |
# Parse the string generated by local_time gem | |
# Expectation : | |
# "<time data-format=\"%B %e, %Y\" data-local=\"time\" datetime=\"2015-10-28T11:19:54Z\">October 28, 2015</time>" | |
def extract_date(date_string) | |
date_string.split('>').pop.split('</')[0] rescue '' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment