XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
87 stars 64 forks source link

Default Date format #342

Open v1har opened 5 months ago

v1har commented 5 months ago

SDK you're using (please complete the following information):

Is your feature request related to a problem? Please describe. I am facing an issue with the new MS Dateformat in Accounting API, because my application uses the Date key everywhere for all objects (Invoice, Credit Note, etc) and now the code shows wrong date for these objects. I would like a setting to use custom format for date objects.

Describe the solution you'd like In Configuration.php (or in a configuration file) I would set the default date format for Date and Datetime objects too. Then the date getter functions would return with the date in that custom format. In my case I would set 'YYYY-MM-DD' for Date and 'YYYY-MM-DD HH:ii:ss' for DateTime objects.

Additional context What I changed on my end in the Invoice.php:

public function setDate($date){
    // $this->container['date'] = $date;

    $dateObject = StringUtil::convertStringToDateTime($date);
        $this->container['date'] = $dateObject->format('Y-m-d H:i:s');

        return $this;
}
github-actions[bot] commented 5 months ago

PETOSS-384

github-actions[bot] commented 5 months ago

Thanks for raising an issue, a ticket has been created to track your request