Code Duplication    Length = 10-11 lines in 2 locations

model/fieldtypes/Date.php 1 location

@@ 49-58 (lines=10) @@
46
47
		if(is_numeric($value)) {
48
			$this->value = date('Y-m-d', $value);
49
		} elseif(is_string($value)) {
50
			try{
51
				$date = new DateTime($value);
52
				$this->value = $date->Format('Y-m-d');
53
				return;
54
			}catch(Exception $e){
55
				$this->value = null;
56
				return;
57
			}
58
		}
59
	}
60
61
	/**

model/fieldtypes/Datetime.php 1 location

@@ 43-53 (lines=11) @@
40
41
		if(is_numeric($value)) {
42
			$this->value = date('Y-m-d H:i:s', $value);
43
		} elseif(is_string($value)) {
44
			// $this->value = date('Y-m-d H:i:s', strtotime($value));
45
			try{
46
				$date = new DateTime($value);
47
				$this->value = $date->Format('Y-m-d H:i:s');
48
				return;
49
			}catch(Exception $e){
50
				$this->value = null;
51
				return;
52
			}
53
		}
54
	}
55
56
	/**