Sha256: 86e74960c001245f985e03394b8590448e3bba3bde9917ddd33c1ad5ffdb6fc6

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

module "strftime"

momentMap =
  "%a": "ddd"
  "%A": "dddd"
  "%b": "MMM"
  "%B": "MMMM"
  "%c": "toString()"
  "%d": "DD"
  "%e": "D"
  "%H": "HH"
  "%I": "hh"
  "%l": "h"
  "%m": "MM"
  "%M": "mm"
  "%p": "A"
  "%P": "a"
  "%S": "ss"
  "%w": "e"
  "%y": "YY"
  "%Y": "YYYY"

for day in [0..30] by 6
  do (day) ->
    for hour in [0..24] by 6
      do (hour) ->
        for format, momentFormat of momentMap
          do (format, momentFormat) ->

            test "#{format} (+#{day} days, #{hour} hours)", ->
              now = moment().add("days", day).add("hours", hour)
              el  = addTimeEl format, now.toISOString()
              run()

              equal el.innerText,
                if func = momentFormat.match(/(\w+)\(\)/)?[1]
                  now.toDate()[func]()
                else
                  now.format momentFormat

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
local_time-0.1.0 test/javascripts/unit/strftime_test.js.coffee