public function setNotionDate($fd)
 {
     if ($fd instanceof FuzzyDateTime) {
         if ($this->getNotionDate() != $fd->getDateTimeMaskedAsArray()) {
             $this->_set('notion_date', $fd->format('Y/m/d'));
             $this->_set('notion_date_mask', $fd->getMask());
         }
     } else {
         $dateTime = new FuzzyDateTime($fd, 56, true);
         if ($this->getNotionDate() != $dateTime->getDateTimeMaskedAsArray()) {
             $this->_set('notion_date', $dateTime->format('Y/m/d'));
             $this->_set('notion_date_mask', $dateTime->getMask());
         }
     }
 }
$t->is(FuzzyDateTime::checkDateTimeStructure($testArray), 'month_missing', 'Date structure test ok');
$testArray['year'] = '';
$t->is(FuzzyDateTime::checkDateTimeStructure($testArray), 'year_missing', 'Date structure test ok');
$testArray['year'] = '1975';
$testArray['month'] = '02';
$testArray['day'] = '';
$testArray['hour'] = '02';
$t->is(FuzzyDateTime::checkDateTimeStructure($testArray), 'day_missing', 'Date structure test ok');
$testArray['year'] = '0001';
$testArray['month'] = '01';
$testArray['day'] = '01';
$fdt = new FuzzyDateTime($testArray);
$t->is($fdt->format('d/m/Y'), '01/01/0001', 'Date lower bound format ok');
$testArray = array('year' => '', 'month' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '');
$fdt = new FuzzyDateTime('2009/12/05');
$t->is_deeply($fdt->getDateTimeMaskedAsArray(), $testArray, 'array is the same');
$testArray = array('year' => 2009, 'month' => 12, 'day' => '', 'hour' => '', 'minute' => '', 'second' => '');
$fdt->setMask(48);
$t->is_deeply($fdt->getDateTimeMaskedAsArray(), $testArray, 'array is the same');
$testArray = array('year' => 2009, 'month' => 12, 'day' => 05, 'hour' => '', 'minute' => '', 'second' => '');
$fdt->setMask(56);
$t->is_deeply($fdt->getDateTimeMaskedAsArray(), $testArray, 'array is the same');
$testArray = array('year' => 2009, 'month' => 2);
$t->is('2009/02/28', FuzzyDateTime::getDateTimeStringFromArray($testArray, false), 'Date are nicelly completed with missing day in fev');
$testArray = array('year' => 2009, 'month' => 12);
$t->is('2009/12/31', FuzzyDateTime::getDateTimeStringFromArray($testArray, false), 'Date are nicelly completed  with missing day in decembre');
$testArray = array('year' => 2009, 'month' => 100);
$t->is('2038/12/31', FuzzyDateTime::getDateTimeStringFromArray($testArray, false), 'Default date is set from wrong dates');
$fdt = new FuzzyDateTime(array('year' => '2005', 'month' => '02', 'day' => '02', 'hour' => '01', 'minute' => 0, 'second' => 0), 63, false, true);
$fdt->setDateFormat('Y/m/d');
$t->is($fdt->getDateMasked(), '2005/02/02 01:00:00', 'Default date is set from wrong dates');
Beispiel #3
0
 public function getIgDate()
 {
     $from_date = new FuzzyDateTime($this->_get('ig_date'), $this->_get('ig_date_mask'));
     return $from_date->getDateTimeMaskedAsArray();
 }
 /** 
  * Get date From as array with masked values
  * @return array an array of masked elements with key year,month,day,hour,minute,second
  * @see FuzzyDateTime::getDateTimeMaskedAsArray
  */
 public function getDateFrom()
 {
     $date = new FuzzyDateTime($this->_get('date_from'), $this->_get('date_from_mask'), false, true);
     return $date->getDateTimeMaskedAsArray();
 }
 /** 
  * Get Modification Date as array with masked values
  * @return array an array of masked elements with key year,month,day,hour,minute,second
  * @see FuzzyDateTime::getDateTimeMaskedAsArray
  */
 public function getModificationDateTime()
 {
     $date = new FuzzyDateTime($this->_get('modification_date_time'), $this->_get('modification_date_mask'), true, true);
     return $date->getDateTimeMaskedAsArray();
 }
Beispiel #6
0
 public function getGtuToDate()
 {
     $to_date = new FuzzyDateTime($this->_get('gtu_to_date'), $this->_get('gtu_to_date_mask'), false, true);
     return $to_date->getDateTimeMaskedAsArray();
 }
 public function getExpeditionToDate()
 {
     $to_date = new FuzzyDateTime($this->_get('expedition_to_date'), $this->_get('expedition_to_date_mask'), false);
     return $to_date->getDateTimeMaskedAsArray();
 }