Completed
Pull Request — develop (#230)
by
unknown
19:20
created
src/PhpSpreadsheet/Calculation/DateTime.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1149,15 +1149,15 @@
 block discarded – undo
1149 1149
             return Functions::VALUE();
1150 1150
         }
1151 1151
 
1152
-		if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
1153
-			if ($dateValue < 1.0) {
1154
-				return 0;
1155
-			} elseif ($dateValue < 0.0) {
1156
-				return Functions::NAN();
1157
-			}
1158
-		}
1159
-
1160
-		// Execute function
1152
+        if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
1153
+            if ($dateValue < 1.0) {
1154
+                return 0;
1155
+            } elseif ($dateValue < 0.0) {
1156
+                return Functions::NAN();
1157
+            }
1158
+        }
1159
+
1160
+        // Execute function
1161 1161
         $PHPDateObject = Date::excelToDateTimeObject($dateValue);
1162 1162
 
1163 1163
         return (int) $PHPDateObject->format('j');
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Date.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -186,23 +186,23 @@  discard block
 block discarded – undo
186 186
     public static function excelToDateTimeObject($excelTimestamp, $timeZone = null)
187 187
     {
188 188
         $timeZone = ($timeZone === null) ? self::getDefaultTimezone() : self::validateTimeZone($timeZone);
189
-		if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
190
-			if ($excelTimestamp < 1.0) {
191
-				// Unix timestamp base date
192
-				$baseDate = new \DateTime('1970-01-01', $timeZone);
193
-			} else {
194
-				// MS Excel calendar base dates
195
-				if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) {
196
-					// Allow adjustment for 1900 Leap Year in MS Excel
197
-					$baseDate = ($excelTimestamp < 60) ? new \DateTime('1899-12-31', $timeZone) : new \DateTime('1899-12-30', $timeZone);
198
-				} else {
199
-					$baseDate = new \DateTime('1904-01-01', $timeZone);
200
-				}
201
-			}
202
-		}
203
-		else {
204
-			$baseDate = new \DateTime('1899-12-30', $timeZone);
205
-		}
189
+        if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
190
+            if ($excelTimestamp < 1.0) {
191
+                // Unix timestamp base date
192
+                $baseDate = new \DateTime('1970-01-01', $timeZone);
193
+            } else {
194
+                // MS Excel calendar base dates
195
+                if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) {
196
+                    // Allow adjustment for 1900 Leap Year in MS Excel
197
+                    $baseDate = ($excelTimestamp < 60) ? new \DateTime('1899-12-31', $timeZone) : new \DateTime('1899-12-30', $timeZone);
198
+                } else {
199
+                    $baseDate = new \DateTime('1904-01-01', $timeZone);
200
+                }
201
+            }
202
+        }
203
+        else {
204
+            $baseDate = new \DateTime('1899-12-30', $timeZone);
205
+        }
206 206
 
207 207
         $days = floor($excelTimestamp);
208 208
         $partDay = $excelTimestamp - $days;
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
         $partDay = $partDay * 60 - $minutes;
213 213
         $seconds = round($partDay * 60);
214 214
 
215
-		if ($days >= 0) {
216
-	        $days = '+' . $days;
217
-		}
215
+        if ($days >= 0) {
216
+            $days = '+' . $days;
217
+        }
218 218
         $interval = $days . ' days';
219 219
 
220 220
         return $baseDate->modify($interval)
Please login to merge, or discard this patch.