class Jennifer::Model::TimeZoneConverter

Overview

Default converter for Time fields.

Converts time to Jennifer::Config.local_time_zone.

Defined in:

jennifer/model/time_zone_converter.cr

Constant 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

Class Method Detail

def self.coerce(value : String, options) : Time? #

Coerces string to Time


[View source]
def self.date_time?(value : String) : Bool #

Returns whether given string has a date-time format


[View source]
def self.default_date_format #

Returns default date format to coerce String to Time


[View source]
def self.default_date_time_format #

Returns default date-time format to coerce String to Time


[View source]
def self.default_time_format #

Returns default time format to coerce String to Time


[View source]
def self.from_db(pull, options) #

[View source]
def self.from_hash(hash : Hash, column, options) #

[View source]
def self.time?(value : String) : Bool #

Returns whether given string has a time format


[View source]
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.


[View source]
def self.to_db(value : Nil, options) #

[View source]