-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Description
I am trying to set a default DateTime format for my app, so I did this in a JS file and included it into my application.js
import LocalTime from "local-time"
LocalTime.config.i18n["en"]["date"]["formats"]["default"] = "%b %e, %Y"
LocalTime.config.i18n["en"]["datetime"]["formats"]["default"] = "%b %e, %Y"
LocalTime.config.i18n["en"]["time"]["formats"]["default"] = "%b %e, %Y"
LocalTime.start()
I printed in the console and see the updated default format, but all of my DateTimes still show in the original default format. I am only interested in DateTime. I set the default on all of them just in case I was passing an unexpected type.
I called local_time in the view like this with :my_format being added to the formats instead of overriding default:
<%= local_time(@my_date_time) %>
<%= local_time(@my_date_time, format: :my_format) %>
<%= local_time(@my_date_time, :my_format) %>
Metadata
Metadata
Assignees
Labels
No labels