How to test if date is ISO 8601 type or not?

In Ruby how would I test if the date is ISO 8601 type or not ?

require ‘date’

Date.today.strftime("%V") # => “51”
Date.today.strftime("%U") # => “50”

Looking for a method say #date_type, which will tell us what kind of
date object it is.

Date.today.date_type # => ‘ISO 8601’

Am 19.12.2013 11:36, schrieb Love U Ruby:

In Ruby how would I test if the date is ISO 8601 type or not ?

require ‘date’

Looking for a method say #date_type, which will tell us what kind of
date object it is.

Date.today.date_type # => ‘ISO 8601’

That doesn’t make any sense. ISO 8601 is about date representations,
which has nothing to do with how a date is stored in a Date object.
Not the date object itself does or does not conform to ISO 8601,
only a string that represents the date can do that.

Date.today.strftime("%V") # => “51”
Date.today.strftime("%U") # => “50”

No idea what you are trying to say with this example.
“%V” and “%U” are different things – they use different ways
of how to count weeks in a year (see the docs) --,
and not surprisingly can therefore give different results.

Regards,
Marcus