Skip to content

Commit

Permalink
Localize datepicker date format
Browse files Browse the repository at this point in the history
  • Loading branch information
laurens authored and radar committed Nov 22, 2012
1 parent de82fcc commit 58f45b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion core/app/views/spree/admin/products/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@
<%= f.field_container :available_on do %>
<%= f.label :available_on, t(:available_on) %>
<%= f.error_message_on :available_on %>
<%= f.text_field :available_on, :value => (@product.available_on.blank? ? '' : @product.available_on.strftime('%Y/%m/%d')), :class => 'datepicker' %>
<% if @product.available_on? %>
<% available_on = l(@product.available_on, :format => t('spree.date_picker.format')) %>
<% else %>
<% available_on = nil %>
<% end %>
<%= f.text_field :available_on, :value => available_on, :class => 'datepicker' %>
<% end %>

<% unless @product.has_variants? %>
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/spree/admin/shared/_translations.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
Spree.translations = <%==
{ :date_picker => I18n.t(:format,
{ :date_picker => I18n.t(:js_format,
:scope => 'spree.date_picker',
:default => 'yy/mm/dd'),
:abbr_day_names => I18n.t(:abbr_day_names, :scope => :date),
Expand Down
3 changes: 2 additions & 1 deletion core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,8 @@ en:
spree:
date: Date
date_picker:
format: 'yy/mm/dd'
format: ! '%m/%d/%Y'
js_format: 'mm/dd/yy'
time: Time
spree_gateway_error_flash_for_checkout: "There was a problem with your payment information. Please check your information and try again."
spree_inventory_error_flash_for_insufficient_quantity: "An item in your cart has become unavailable."
Expand Down

0 comments on commit 58f45b1

Please sign in to comment.