Skip to content

Commit

Permalink
Move Date.parse to the stdlib section and make it compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Oct 28, 2013
1 parent a946edc commit f22ee6b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions corelib/time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ def self.now
`new Date()`
end

def self.parse(str)
`Date.parse(str)`
end

def +(other)
if Time === other
raise TypeError, "time + time?"
Expand Down Expand Up @@ -517,3 +513,14 @@ def to_n
self
end
end

# FIXME: move this to stdlib when the corelib has its own path
class Time
def self.parse(str)
`new Date(Date.parse(str))`
end

def iso8601
strftime('%FT%T%z')
end
end

0 comments on commit f22ee6b

Please sign in to comment.