Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Issue/CreateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
*/
class CreateRequest
{
/**
* Jira REST API accepts a non-standard format similar to ISO 8601.
*
* The differences are that Jira requires the following:
* 1. Fractional seconds, e.g. ".00" or ".000" after the seconds.
* 2. Timezone format without a colon, e.g. "+0000".
*
* @example 2018-03-04T23:44:57.00+0000
* @see https://jira.atlassian.com/browse/JRASERVER-61378
*/
private const JIRA_DATE_TIME_FORMAT = 'Y-m-d\TH:i:s.00O';

/** @var \Badoo\Jira\REST\Client */
protected $Jira;

Expand Down Expand Up @@ -439,6 +451,16 @@ public function setDueDate($ts) : CreateRequest
return $this->setDateField('Due Date', $ts);
}

/**
* @param string $field Field name.
* @param int $timestamp Unix timestamp, in seconds.
* @return $this
*/
public function setDateTimeField(string $field, int $timestamp): self
{
return $this->setFieldValue($field, date(self::JIRA_DATE_TIME_FORMAT, $timestamp));
}

/**
* @param string $field_name - имя поля, как оно отображается в интерфейсе Jira (Assignee, Build_Name, ...)
* @param mixed $value
Expand Down