-
Notifications
You must be signed in to change notification settings - Fork 8
Feature a Few Fixes #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature a Few Fixes #199
Changes from 3 commits
3d34db3
6087c04
b96f386
30b8d82
fd4e1cf
ee22c40
d8c2a1a
56b872e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,20 +12,24 @@ public static function fromJson(array $data): self | |||||
| { | ||||||
| if ($startDateTime = Arr::get($data, 'StartDateTime')) { | ||||||
| $startDateTime = Str::of($startDateTime)->after('(')->before(')'); | ||||||
| $startDateTime = Carbon::createFromTimestamp($startDateTime); | ||||||
| // Extract milliseconds part (ignore optional timezone offset like +0000) | ||||||
| $milliseconds = (int) (string) $startDateTime; | ||||||
| $startDateTime = Carbon::createFromTimestampMs($milliseconds, 'UTC'); | ||||||
| } | ||||||
|
|
||||||
| if ($endDateTime = Arr::get($data, 'EndDateTime')) { | ||||||
| $endDateTime = Str::of($endDateTime)->after('(')->before(')'); | ||||||
| $endDateTime = Carbon::createFromTimestamp($endDateTime); | ||||||
| // Extract milliseconds part (ignore optional timezone offset like +0000) | ||||||
| $milliseconds = (int) (string) $endDateTime; | ||||||
| $endDateTime = Carbon::createFromTimestampMs($milliseconds, 'UTC'); | ||||||
| } | ||||||
|
|
||||||
| return new self( | ||||||
| isOutOfOffice: Arr::get($data, 'IsOutOfOffice'), | ||||||
| startDateTime: $startDateTime, | ||||||
| startDateTimeSpecified: Arr::get($data, 'StartDateTimeSpecified'), | ||||||
| endDateTime: $endDateTime, | ||||||
| endDateTimeSpecified: Arr::get($data, 'EndDateTimeSpecified'), | ||||||
| endDateTimeSpecified: Arr::get($data, key: 'EndDateTimeSpecified'), | ||||||
|
||||||
| endDateTimeSpecified: Arr::get($data, key: 'EndDateTimeSpecified'), | |
| endDateTimeSpecified: Arr::get($data, 'EndDateTimeSpecified'), |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| namespace CodebarAg\DocuWare\Enums; | ||
|
|
||
| enum DocuWareFieldTypeEnum: string | ||
| { | ||
| case STRING = 'String'; | ||
| case INT = 'Int'; | ||
| case DECIMAL = 'Decimal'; | ||
| case DATE = 'Date'; | ||
| case DATETIME = 'DateTime'; | ||
| case TABLE = 'Table'; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,37 @@ | ||||||
| <?php | ||||||
|
|
||||||
| use CodebarAg\DocuWare\Enums\ConnectionEnum; | ||||||
|
|
||||||
| it('has all expected connection enum cases', function () { | ||||||
| $expectedCases = [ | ||||||
| 'WITHOUT_COOKIE', | ||||||
| 'STATIC_COOKIE', | ||||||
| 'DYNAMIC_COOKIE', | ||||||
| ]; | ||||||
|
|
||||||
| $actualCases = array_map(fn ($case) => $case->value, ConnectionEnum::cases()); | ||||||
|
|
||||||
| expect($actualCases)->toBe($expectedCases); | ||||||
|
||||||
| expect($actualCases)->toBe($expectedCases); | |
| expect($actualCases)->toEqualCanonicalizing($expectedCases); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the timezone of the parsed dates to UTC (previously it used the default timezone). If this behavior is intentional, please document it in the method's docblock or relevant README section to make the UTC normalization explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so would you reocment to take app timezone?