Method: D3.time_format_locale

Defined in:
lib/opal/d3/time_format.rb

.time_format_locale(spec = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/opal/d3/time_format.rb', line 18

def time_format_locale(spec={})
  D3::TimeFormatLocale.new @d3.JS.timeFormatLocale(
    {
      dateTime: spec.fetch(:date_time, "%x, %X"),
      date: spec.fetch(:date, "%-m/%-d/%Y"),
      time: spec.fetch(:time, "%-I:%M:%S %p"),
      periods: spec.fetch(:periods, ["AM", "PM"]),
      days: spec.fetch(:days, ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]),
      shortDays: spec.fetch(:short_days, ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]),
      months: spec.fetch(:months, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]),
      shortMonths: spec.fetch(:short_months, ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]),
    }.to_n
  )
end