Class: TimeNoTime
- Inherits:
-
Time
- Object
- Time
- TimeNoTime
- Defined in:
- lib/ext/time_no_time.rb
Overview
A time emulator to keep the fact that the time information was missing, even if it behaves as a Time object for the given date.
Class Method Summary collapse
Instance Method Summary collapse
-
#l18n_long_date_no_year_string ⇒ String
Returns the current Time instance as a localized long string without time nor year.
-
#l18n_long_date_string ⇒ String
Returns the current Time instance as a localized long string without time.
Class Method Details
.parse_no_time(string) ⇒ Object
24 25 26 |
# File 'lib/ext/time_no_time.rb', line 24 def self.parse_no_time(string) strptime("#{string} 00:00:00", '%Y-%m-%d %H:%M:%S') end |
Instance Method Details
#l18n_long_date_no_year_string ⇒ String
Returns the current Time instance as a localized long string
without time nor year.
20 21 22 |
# File 'lib/ext/time_no_time.rb', line 20 def l18n_long_date_no_year_string I18n.l self, format: :long_no_time_no_year end |
#l18n_long_date_string ⇒ String
Returns the current Time instance as a localized long string
without time.
12 13 14 |
# File 'lib/ext/time_no_time.rb', line 12 def l18n_long_date_string I18n.l self, format: :long_no_time end |