Sha256: c906637102cfa78bac66f798dbb01429fa4b7937a03e5e83c58d1d62a06d1d96

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

require_relative 'test_helper'

describe "FastExcel.date_num" do

  it "should save correct date" do
    workbook = FastExcel.open("test.xlsx", constant_memory: true)
    worksheet = workbook.add_worksheet("Payments Report")

    date_format = workbook.number_format("[$-409]m/d/yy h:mm AM/PM;@")
    worksheet.set_column(0, 0, 20, date_format)

    date = DateTime.parse('2017-03-01 15:15:15 +0000').to_time

    worksheet.write_number(0, 0, FastExcel.date_num(date), nil)
    workbook.close

    data = parse_xlsx_as_matrix("test.xlsx")

    assert_equal(data[0][0].to_time, date)
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
fast_excel-0.2.2 test/date_test.rb
kmadej_fast_excel_fork-0.2.2 test/date_test.rb
fast_excel-0.2.1 test/date_test.rb
fast_excel-0.2.0 test/date_test.rb
fast_excel-0.1.7 test/date_test.rb