Class: Time

Inherits:
Object show all
Defined in:
lib/nrser/core_ext/time.rb

Overview

Definitions

Instance Method Summary collapse

Instance Method Details

#iso8601_for_idiotsString

‘#iso8601` with the `-` and `:` characters removed. Intended to be more agreeable to a wider range of file systems and programs than the standard format, while still adhering to ISO 8601 (as far as I can tell) and acceptable to parse.

There is nothing tricky about this method; I just wanted to standardize a format for these situations. I hate reading date-times like this, but it seems like the best and safest approach :/

Examples:

time = Time.now

time.iso8601
# => "2018-04-19T03:00:30+08:00" # Nice, but potentially problematic

Time.now.iso8601_for_files
# => "20180419T030030+8000" # Fucking ugly, but easier on stupid systems

Returns:



42
43
44
# File 'lib/nrser/core_ext/time.rb', line 42

def iso8601_for_idiots
  iso8601.gsub /\-\:/, ''
end