mongoid-friendly-timestamps 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
|
|
1
1
|
module Mongoid
|
2
2
|
module Friendly
|
3
3
|
module Timestamps
|
4
|
+
FRIENDLY_FORMAT = '%d-%b-%Y %H:%M:%S.%N'
|
5
|
+
|
4
6
|
extend ActiveSupport::Concern
|
5
7
|
|
6
8
|
module ClassMethods
|
@@ -19,7 +21,7 @@ module Mongoid
|
|
19
21
|
update_friendly_field_method_name = "update_friendly_timestamp_field_#{friendly_name}"
|
20
22
|
|
21
23
|
define_method update_friendly_field_method_name do
|
22
|
-
self[friendly_name] = Time.at(self[raw_name]).strftime
|
24
|
+
self[friendly_name] = Time.at(self[raw_name]).utc.strftime FRIENDLY_FORMAT
|
23
25
|
end
|
24
26
|
|
25
27
|
define_method "#{raw_name}=" do |value|
|