Skip to content

Commit

Permalink
Fix bad merge conflict in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Aug 29, 2023
1 parent 46ed559 commit 42d8b1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ Will serialize to this JSON:
}
```

#### `timezone`

The `timezone` argument may be any timezone string legal in PHP, such as `America/Chicago` or `UTC`. If specified, the value will be cast to this timezone first before it is serialized. If not specified, the value will be left in whatever timezone it is in before being serialized. Whether that makes a difference to the output depends on the `format`.

On deserializing, the `timezone` has no effect. If the incoming value has a timezone specified, the resulting `DateTime[Immutable]` object will use that timezone. If not, the system default timezone will be used.

#### `format`

This argument lets you specify the format that will be used when serializing. It may be any string accepted by PHP's [date_format syntax](https://www.php.net/manual/en/datetimeimmutable.createfromformat.php), including one of the various constants defined on `DateTimeInterface`. If not specified, the default format is `RFC3339_EXTENDED`, or `Y-m-d\TH:i:s.vP`. While not the most human-friendly, it is the default format used by Javascript/JSON so makes for reasonable compatibility.
Expand Down Expand Up @@ -678,13 +684,6 @@ This setup will lazily pull records out of the database and instantiate an objec

While likely overkill for CSV, it can work very well for more involved objects being serialized to JSON.

#### `timezone`

The `timezone` argument may be any timezone string legal in PHP, such as `America/Chicago` or `UTC`. If specified, the value will be cast to this timezone first before it is serialized. If not specified, the value will be left in whatever timezone it is in before being serialized. Whether that makes a difference to the output depends on the `format`.

On deserializing, the `timezone` has no effect. If the incoming value has a timezone specified, the resulting `DateTime[Immutable]` object will use that timezone. If not, the system default timezone will be used.
>>>>>>> e771892 (Support custom serialization formats for DateTime fields.)
### TypeMaps

Type maps are a powerful feature of Serde that allows precise control over how objects with inheritance are serialized and deserialized. Type Maps translate between the class of an object and some unique identifier that is included in the serialized data.
Expand Down

0 comments on commit 42d8b1a

Please sign in to comment.