Skip to content

Commit

Permalink
Use default type cast for recorded_at
Browse files Browse the repository at this point in the history
Previously, `recorded_at` was consistently returned in UTC format, with
the reason for this decision not explicitly documented in the commit
history.

This commit modifies the behavior to use the application's configured
timezone for `recorded_at`, aligning with the default type cast for
timestamp fields.

This adjustment ensures that timestamp data is presented in a more
intuitive format for users, potentially enhancing user experience and
data interpretation.

### Before:

```
Activity.last.history.first.recorded_at
=> 2024-01-05 14:40:18.656918 UTC
```

### After:

```
Activity.last.history.first.recorded_at
=> Fri, 05 Jan 2024 15:40:18.656918000 CET +01:00
```
  • Loading branch information
tagliala committed Feb 27, 2024
1 parent a345bde commit 96211c1
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/chrono_model/time_machine/history_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ def valid_to
end
alias as_of_time valid_to

def recorded_at
ChronoModel::Conversions.string_to_utc_time attributes_before_type_cast['recorded_at']
end

# Starting from Rails 6.0, `.read_attribute` will use the memoized
# `primary_key` if it detects that the attribute name is `id`.
#
Expand Down

0 comments on commit 96211c1

Please sign in to comment.