class Jennifer::Model::TimeZoneConverter
- Jennifer::Model::TimeZoneConverter
- Reference
- Object
Overview
Default converter for Time
fields.
Converts time to Jennifer::Config.local_time_zone
.
Defined in:
jennifer/model/time_zone_converter.crConstant Summary
-
DATE_FORMAT =
"%F"
-
DATE_TIME_FORMAT =
"#{DATE_FORMAT} %T"
-
TIME_FORMAT =
"%H:%M"
-
TIME_REGEXP =
/^([0-1]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/
Class Method Summary
-
.coerce(value : String, options) : Time?
Coerces string to Time
-
.date_time?(value : String) : Bool
Returns whether given string has a date-time format
-
.default_date_format
Returns default date format to coerce
String
toTime
-
.default_date_time_format
Returns default date-time format to coerce
String
toTime
-
.default_time_format
Returns default time format to coerce
String
toTime
- .from_db(pull, options)
- .from_hash(hash : Hash, column, options)
-
.time?(value : String) : Bool
Returns whether given string has a time format
-
.to_db(value : Time, options)
Returns time as is as any Time object is converted to UTC automatically by query builder.
- .to_db(value : Nil, options)
Class Method Detail
def self.to_db(value : Time, options)
#
Returns time as is as any Time object is converted to UTC automatically by query builder.
If :time_zone_aware
is false
- changes time zone to application one instead of converting.