1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
This commit is contained in:
David Bomba 2019-08-28 09:19:54 +10:00
parent b92b7cbe63
commit 33b42db47c
4 changed files with 24 additions and 2 deletions

View File

@ -55,6 +55,9 @@ class InvoiceController extends Controller
->editColumn('status_id', function ($invoice){
return Invoice::badgeForStatus($invoice->status);
})
->editColumn('invoice_date', function ($invoice){
return
})
->rawColumns(['checkbox', 'action', 'status_id'])
->make(true);

View File

@ -18,6 +18,12 @@ namespace App\Utils\Traits;
trait MakesDates
{
/**
* Converts from UTC to client timezone
* @param datetime object $utc_date
* @param string $timezone ie Australia/Sydney
* @return Carbon Carbon object
*/
public function createClientDate($utc_date , $timezone)
{

View File

@ -48,7 +48,7 @@ class CompareObjectTest extends TestCase
$this->assertEquals($build_client_settings->timezone_id, 15);
$this->assertEquals($build_client_settings->currency_id, 1);
$this->assertEquals($build_client_settings->language_id, 1);
$this->assertEquals($build_client_settings->payment_terms, 7);
$this->assertEquals($build_client_settings->payment_terms, 1);
}
public function testDirectClientSettingsBuild()
@ -58,7 +58,7 @@ class CompareObjectTest extends TestCase
$this->assertEquals($settings->timezone_id, 15);
$this->assertEquals($settings->currency_id, 1);
$this->assertEquals($settings->language_id, 1);
$this->assertEquals($settings->payment_terms, 7);
$this->assertEquals($settings->payment_terms, 1);
$this->assertEquals($settings->custom_taxes1, 'FALSE');
}

View File

@ -68,6 +68,19 @@ class MakesDatesTest extends TestCase
$this->assertEquals('2007-04-19 23:59', $date_time->format('Y-m-d H:i'));
}
public function testCreateClientDate()
{
$client_date_src = '2007-04-19 22:59';
$client_timezone = 'Atlantic/Cape_Verde'; // -1 UTC
$date_time = new \DateTime($client_date_src, new \DateTimeZone($client_timezone));
$utc_date = $this->createUtcDate($date_time, $client_timezone);
$client_date = $this->createClientDate($utc_date, $client_timezone);
$this->assertEquals('2007-04-19 22:59', $client_date->format('Y-m-d H:i'));
}
}