Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Clarification on to_date method of DateTime class #23

@runwaldarshu

Description

@runwaldarshu

I would like to know what type of object to expect when we call to_date method on DateTime object.
I was hoping that will be ISO8601::Date object but seeing some different results.
For instance if I call new on Date object "ISO8601::Date.new('2014-05-02')" I can call weeks method on it and returns correct results but I do same with DateTime class and to_date method get an error

2.1.5 :001 > require 'iso8601'
 => true
2.1.5 :002 > ISO8601::Date.new('2014-W05').week
 => 5
2.1.5 :003 > ISO8601::DateTime.new('2014-05-02').to_date.week
NoMethodError: undefined method `week' for #<Date: 2014-05-02 ((2456780j,0s,0n),+0s,2299161j)>
    from (irb):3
    from /Users/DR029931/.rvm/rubies/ruby-2.1.5/bin/irb:11:in `<main>'

Just wanted some clarification for my understanding.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions