fix export dates are not localized (#5368)
This commit is contained in:
@@ -80,7 +80,6 @@ class Invoice implements EntityWithMetaFields
|
|||||||
#[Assert\NotNull]
|
#[Assert\NotNull]
|
||||||
#[Serializer\Expose]
|
#[Serializer\Expose]
|
||||||
#[Serializer\Groups(['Default'])]
|
#[Serializer\Groups(['Default'])]
|
||||||
#[Exporter\Expose(label: 'date', type: 'datetime')]
|
|
||||||
private ?\DateTime $createdAt = null;
|
private ?\DateTime $createdAt = null;
|
||||||
#[ORM\Column(name: 'timezone', type: 'string', length: 64, nullable: false)]
|
#[ORM\Column(name: 'timezone', type: 'string', length: 64, nullable: false)]
|
||||||
private ?string $timezone = null;
|
private ?string $timezone = null;
|
||||||
@@ -176,6 +175,7 @@ class Invoice implements EntityWithMetaFields
|
|||||||
return $this->total;
|
return $this->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Exporter\Expose(name: 'createdAt', label: 'date', type: 'datetime')]
|
||||||
public function getCreatedAt(): ?\DateTime
|
public function getCreatedAt(): ?\DateTime
|
||||||
{
|
{
|
||||||
if (!$this->localized) {
|
if (!$this->localized) {
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ class Project implements EntityWithMetaFields, EntityWithBudget, CreatedAt
|
|||||||
#[Serializer\Groups(['Project_Entity'])]
|
#[Serializer\Groups(['Project_Entity'])]
|
||||||
#[Serializer\Type(name: "DateTime<'Y-m-d'>")]
|
#[Serializer\Type(name: "DateTime<'Y-m-d'>")]
|
||||||
#[Serializer\Accessor(getter: 'getOrderDate')]
|
#[Serializer\Accessor(getter: 'getOrderDate')]
|
||||||
#[Exporter\Expose(label: 'orderDate', type: 'datetime')]
|
|
||||||
private ?\DateTime $orderDate = null;
|
private ?\DateTime $orderDate = null;
|
||||||
/**
|
/**
|
||||||
* Project start date (times before this date cannot be recorded)
|
* Project start date (times before this date cannot be recorded)
|
||||||
@@ -99,7 +98,6 @@ class Project implements EntityWithMetaFields, EntityWithBudget, CreatedAt
|
|||||||
#[Serializer\Groups(['Project'])]
|
#[Serializer\Groups(['Project'])]
|
||||||
#[Serializer\Type(name: "DateTime<'Y-m-d'>")]
|
#[Serializer\Type(name: "DateTime<'Y-m-d'>")]
|
||||||
#[Serializer\Accessor(getter: 'getStart')]
|
#[Serializer\Accessor(getter: 'getStart')]
|
||||||
#[Exporter\Expose(label: 'project_start', type: 'datetime')]
|
|
||||||
private ?\DateTime $start = null;
|
private ?\DateTime $start = null;
|
||||||
/**
|
/**
|
||||||
* Project end time (times after this date cannot be recorded)
|
* Project end time (times after this date cannot be recorded)
|
||||||
@@ -111,7 +109,6 @@ class Project implements EntityWithMetaFields, EntityWithBudget, CreatedAt
|
|||||||
#[Serializer\Groups(['Project'])]
|
#[Serializer\Groups(['Project'])]
|
||||||
#[Serializer\Type(name: "DateTime<'Y-m-d'>")]
|
#[Serializer\Type(name: "DateTime<'Y-m-d'>")]
|
||||||
#[Serializer\Accessor(getter: 'getEnd')]
|
#[Serializer\Accessor(getter: 'getEnd')]
|
||||||
#[Exporter\Expose(label: 'project_end', type: 'datetime')]
|
|
||||||
private ?\DateTime $end = null;
|
private ?\DateTime $end = null;
|
||||||
#[ORM\Column(name: 'timezone', type: 'string', length: 64, nullable: true)]
|
#[ORM\Column(name: 'timezone', type: 'string', length: 64, nullable: true)]
|
||||||
private ?string $timezone = null;
|
private ?string $timezone = null;
|
||||||
@@ -291,6 +288,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget, CreatedAt
|
|||||||
$this->localized = true;
|
$this->localized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Exporter\Expose(name: 'orderDate', label: 'orderDate', type: 'date')]
|
||||||
public function getOrderDate(): ?\DateTime
|
public function getOrderDate(): ?\DateTime
|
||||||
{
|
{
|
||||||
$this->localizeDates();
|
$this->localizeDates();
|
||||||
@@ -309,6 +307,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget, CreatedAt
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Exporter\Expose(name: 'start', label: 'project_start', type: 'date')]
|
||||||
public function getStart(): ?\DateTime
|
public function getStart(): ?\DateTime
|
||||||
{
|
{
|
||||||
$this->localizeDates();
|
$this->localizeDates();
|
||||||
@@ -327,6 +326,7 @@ class Project implements EntityWithMetaFields, EntityWithBudget, CreatedAt
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Exporter\Expose(name: 'end', label: 'project_end', type: 'date')]
|
||||||
public function getEnd(): ?\DateTime
|
public function getEnd(): ?\DateTime
|
||||||
{
|
{
|
||||||
$this->localizeDates();
|
$this->localizeDates();
|
||||||
|
|||||||
@@ -174,9 +174,9 @@ class ProjectTest extends AbstractEntityTestCase
|
|||||||
['name', 'string'],
|
['name', 'string'],
|
||||||
['customer', 'string'],
|
['customer', 'string'],
|
||||||
['orderNumber', 'string'],
|
['orderNumber', 'string'],
|
||||||
['orderDate', 'datetime'],
|
['orderDate', 'date'],
|
||||||
['project_start', 'datetime'],
|
['project_start', 'date'],
|
||||||
['project_end', 'datetime'],
|
['project_end', 'date'],
|
||||||
['budget', 'float'],
|
['budget', 'float'],
|
||||||
['timeBudget', 'duration'],
|
['timeBudget', 'duration'],
|
||||||
['budgetType', 'string'],
|
['budgetType', 'string'],
|
||||||
|
|||||||
Reference in New Issue
Block a user