README.md in local_time-0.2.0 vs README.md in local_time-0.3.0
- old
+ new
@@ -35,10 +35,17 @@
Alias for local_time with a month-formatted default
<%= local_date(time, format: '%B %e, %Y') %>
```
+To use a strftime format already defined in your app, pass a symbol as the format.
+```erb
+<%= local_time(date, format: :long) %>
+```
+
+`I18n.t("time.formats.#{format}")`, `I18n.t("date.formats.#{format}")`, `Time::DATE_FORMATS[format]`, and `Date::DATE_FORMATS[format]` will be scanned (in that order) for your format.
+
Note: The included strftime JavaScript implementation is not 100% complete. It supports the following directives: `%a %A %b %B %c %d %e %H %I %l %m %M %p %P %S %w %y %Y`
#### Time ago helper
```erb
@@ -61,10 +68,27 @@
#### JavaScript events and library compatibility
The included JavaScript does not depend on any frameworks or libraries, and listens for a `DOMContentLoaded` event to run initially. It also listens on `document` for `page:update` if you're using Turbolinks and `ajaxSuccess` if you're using jQuery. This should catch most cases where new `<time>` elements have been added to the DOM and process them automatically. If you're adding new elements in another context, trigger `time:elapse` to process them.
+#### JavaScript API
+
+`strftime` and `relativeTimeAgo` are available via the global `LocalTime` object.
+
+```js
+> LocalTime.strftime(new Date, "%B %e, %Y %l:%M%P")
+"February 9, 2014 12:55pm"
+
+> LocalTime.relativeTimeAgo(new Date(new Date - 60 * 1000 * 5))
+"5 minutes ago"
+```
+
#### Version History
+
+**0.3.0** (February 9, 2014)
+
+* Allow :format option lookup in I18n or DATE_FORMATS hashes [Paul Dobbins]
+* Expose public API to JavaScript helpers
**0.2.0** (December 10, 2013)
* Prefer `textContent` over `innerText` for Firefox compatibility
* Added `options` argument to `local_time_ago` helper