Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
smart_date
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
smart_date
Merge requests
!172
Issue
#3509465
: Augmenters receive inaccurate timestamps
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3509465
: Augmenters receive inaccurate timestamps
issue/smart_date-3509465:3509465-augmenters-receive-inaccurate
into
4.2.x
Overview
0
Commits
1
Pipelines
1
Changes
1
Open
Jonathan Shaw
requested to merge
issue/smart_date-3509465:3509465-augmenters-receive-inaccurate
into
4.2.x
3 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Issue
#3509465
by jonathanshaw: Augmenters receive inaccurate timestamps
0
0
Merge request reports
Compare
4.2.x
4.2.x (HEAD)
and
latest version
latest version
6c2f5803
1 commit,
3 months ago
1 file
+
5
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/SmartDatePluginTrait.php
+
5
−
12
Options
@@ -136,6 +136,9 @@ trait SmartDatePluginTrait {
// Not sure how to handle anything else, so return an empty set.
return
$elements
;
}
$stored_start_ts
=
$start_ts
;
$stored_end_ts
=
$end_ts
;
$timezone
=
$item
->
timezone
?
$item
->
timezone
:
$timezone_override
;
// Do an all day check before manipulating the range.
if
(
static
::
isAllDay
(
$start_ts
,
$end_ts
))
{
@@ -214,9 +217,7 @@ trait SmartDatePluginTrait {
}
if
(
!
empty
(
$augmenters
[
'instances'
]))
{
// @todo examine why we aren't using the $start_ts and $end_ts that are
// already normalized above.
$this
->
augmentOutput
(
$elements
[
$delta
],
$augmenters
[
'instances'
],
$item
->
value
,
$item
->
end_value
,
$timezone
,
$delta
);
$this
->
augmentOutput
(
$elements
[
$delta
],
$augmenters
[
'instances'
],
$stored_start_ts
,
$stored_end_ts
,
$timezone
,
$delta
);
}
}
@@ -303,19 +304,11 @@ trait SmartDatePluginTrait {
* @param string $ends
* An optional timestamp to specify the end of the last instance.
*/
protected
function
augmentOutput
(
array
&
$output
,
array
$augmenters
,
$start_ts
,
$end_ts
,
$timezone
,
$delta
,
$type
=
'instances'
,
$repeats
=
''
,
$ends
=
''
)
{
protected
function
augmentOutput
(
array
&
$output
,
array
$augmenters
,
int
$start_ts
,
int
$end_ts
,
$timezone
,
$delta
,
$type
=
'instances'
,
$repeats
=
''
,
$ends
=
''
)
{
if
(
!
$augmenters
)
{
return
;
}
if
(
!
is_numeric
(
$start_ts
))
{
$start_ts
=
strtotime
(
$start_ts
);
}
if
(
!
is_numeric
(
$end_ts
))
{
$end_ts
=
(
$end_ts
!==
NULL
)
?
strtotime
(
$end_ts
)
:
$start_ts
;
}
foreach
(
$augmenters
as
$augmenter_id
=>
$augmenter
)
{
// Fallback for outdated schema.
if
(
$type
===
'instances'
&&
!
isset
(
$this
->
sharedSettings
[
$type
]))
{
Loading