Skip to content

Commit

Permalink
Added yyyy-mm-ddThh:nn format
Browse files Browse the repository at this point in the history
  • Loading branch information
espen committed Sep 4, 2024
1 parent 1b93de9 commit 4bf19e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/timeliness/definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module Definitions
'ddd, dd mmm yyyy hh:nn:ss tz', # RFC 822
'ddd, dd mmm yyyy hh:nn:ss zo', # RFC 822
'ddd mmm d hh:nn:ss zo yyyy', # Ruby time string
'yyyy-mm-ddThh:nn', # ISO 8601 without seconds
'yyyy-mm-ddThh:nn:ss', # ISO 8601
'yyyy-mm-ddThh:nn:sszo', # ISO 8601 with zone offset
'yyyy-mm-ddThh:nn:sszt', # ISO 8601 with 'Zulu time' (i.e. Z) UTC zone designator
Expand Down
2 changes: 2 additions & 0 deletions spec/timeliness/format_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
'ddd mmm d hh:nn:ss tz yyyy' => {pass: ['Sat Jul 19 12:00:00 EST 2008'], fail: []},
'yyyy-mm-ddThh:nn:sszo' => {pass: ['2008-07-19T12:00:00+10:00'], fail: ['2008-07-19T12:00:00Z+10:00']},
'yyyy-mm-ddThh:nn:ss.uzt' => {pass: ['2019-06-07T03:35:55.100000Z'], fail: []},
'yyyy-mm-dd hh:nn' => {pass: ['2019-06-07 03:35'], fail: []},
'yyyy-mm-ddThh:nn' => {pass: ['2019-06-07T03:35'], fail: []},
}
format_tests.each do |format, values|
it "should correctly match datetimes in format '#{format}'" do
Expand Down

0 comments on commit 4bf19e0

Please sign in to comment.