Open damien-rivet opened 6 years ago
The PreciseDate class has been constructed to mimic the same behaviour as JSS payload when it comes to dates.
PreciseDate
By acception a base key name, it allows the reconstruction of the 3 original keys for any date, like that:
{ "example_date": "XXX", "example_date_epoch": 0, "example_date_utc": "XXX+0500" }
If those keys were embedded in a single key it would have been much more simple to reconstruct the json before sending it to JSS.
An updated payload:
{ "example_date": { "date": "XXX", "epoch": 0, "utc": "XXX+0500" } }
Which in turn would improve the injection of each date in any JSON payload.
How it's currently done:
if let exampleDate = exampleDate { json.merge(exampleDate.toJSON()) { (_, new) in new } }
Currently, this solution is problematic since the test coverage can't make it inside the block.
Find a better way of generating / injecting any date's JSON into another JSON payload.
Context
The
PreciseDate
class has been constructed to mimic the same behaviour as JSS payload when it comes to dates.By acception a base key name, it allows the reconstruction of the 3 original keys for any date, like that:
If those keys were embedded in a single key it would have been much more simple to reconstruct the json before sending it to JSS.
An updated payload:
Which in turn would improve the injection of each date in any JSON payload.
How it's currently done:
Currently, this solution is problematic since the test coverage can't make it inside the block.
Issue
Find a better way of generating / injecting any date's JSON into another JSON payload.