Skip to content

Date field type not supported? #49

@baldwindavid

Description

@baldwindavid

Am I correct in assuming that the :field option is not intended to support a Date column? In my test below, the March 1st appointment shows up in both the February and March by_month queries.

describe Appointment, '#by_month' do

  it 'returns appointments within the month' do
    Appointment.create date: "Feb 1, 2014"
    Appointment.create date: "Feb 28, 2014"
    Appointment.create date: "Mar 1, 2014"

    february_query = Appointment.by_month(2, year: 2014, field: :date)
    expect(february_query.collect {|a| a.date.to_s}).to eq [
      "2014-02-01",
      "2014-02-28"
    ] # fails, because it includes "2014-03-01"

    march_query = Appointment.by_month(3, year: 2014, field: :date)
    expect(march_query.collect {|a| a.date.to_s}).to eq [
      "2014-03-01"
    ]
  end

end

Never mind these being in a date column is not ideal in the first place, but just wanting to make sure that this is a known and intended behavior. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions