Skip to content

Date enhancements #34

Closed
Closed
@Swader

Description

@Swader

The getDate and getEstimatedDate methods could use an upgrade.

The plan is to implement a DateObject with a __toString method to keep backwards compatibility, but to also add in some helper methods (perhaps via Carbon) that turn the Diffbot-returned string into something more useful in the current context. For example:

echo $article->getDate(); // "Wed, 18 Dec 2013 00:00:00 GMT" - as usual!
echo $article->getDate()->year; // 2013

Carbon's setToStringFormat will need to be used to set the format to Diffbot's default, to maintain BC, but other than that, Carbon can be plugged into the entity directly.

Wondering if we should make Carbon a recommendation only, and then crash the SDK if it's not installed an a Carbon method is used, or just force people to use Carbon...?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions