Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Merge requests
!11228
added the current timestamp to offsets for twice the same day issue
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
added the current timestamp to offsets for twice the same day issue
issue/drupal-2842409:2842409-date-filter-selecting
into
11.x
Overview
0
Commits
13
Pipelines
7
Changes
2
Open
Niranjan Reddy Panem
requested to merge
issue/drupal-2842409:2842409-date-filter-selecting
into
11.x
4 months ago
Overview
0
Commits
13
Pipelines
7
Changes
2
Expand
Closes
#2842409
0
0
Merge request reports
Compare
11.x
version 6
6f13070b
3 months ago
version 5
42a7fcd5
4 months ago
version 4
8f03e349
4 months ago
version 3
77db4694
4 months ago
version 2
249de422
4 months ago
version 1
de49d029
4 months ago
11.x (HEAD)
and
latest version
latest version
07d7e90a
13 commits,
3 months ago
version 6
6f13070b
12 commits,
3 months ago
version 5
42a7fcd5
5 commits,
4 months ago
version 4
8f03e349
4 commits,
4 months ago
version 3
77db4694
3 commits,
4 months ago
version 2
249de422
2 commits,
4 months ago
version 1
de49d029
1 commit,
4 months ago
2 files
+
85
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
core/modules/views/src/Plugin/views/filter/Date.php
+
16
−
0
Options
@@ -184,11 +184,27 @@ protected function opBetween($field) {
$a
=
intval
(
strtotime
(
$this
->
value
[
'min'
],
0
));
$b
=
intval
(
strtotime
(
$this
->
value
[
'max'
],
0
));
if
(
$this
->
value
[
'type'
]
==
'date'
)
{
// Check if the max value lacks a time component (i.e., user selected only a date).
if
(
date
(
'H:i:s'
,
strtotime
(
$this
->
value
[
'max'
]))
==
'00:00:00'
)
{
$b
=
intval
(
strtotime
(
$this
->
value
[
'max'
]
.
' +1 day'
,
0
))
-
1
;
}
}
if
(
$this
->
value
[
'type'
]
==
'offset'
)
{
// Keep sign.
$a
=
'***CURRENT_TIME***'
.
sprintf
(
'%+d'
,
$a
);
// Keep sign for max, store original for checking.
$b_original
=
$b
;
// Keep sign.
$b
=
'***CURRENT_TIME***'
.
sprintf
(
'%+d'
,
$b
);
// If min and max are the same and max has no time part (whole days only).
if
(
$this
->
value
[
'min'
]
===
$this
->
value
[
'max'
]
&&
(
$b_original
%
86400
===
0
))
{
// Convert offset to days.
$offset_days
=
intdiv
(
$b_original
,
86400
);
// Set $b to the end of that day (23:59:59).
$b
=
'***CURRENT_TIME***'
.
sprintf
(
'%+d'
,
(
$offset_days
*
86400
)
+
86399
);
}
}
// This is safe because we are manually scrubbing the values. It is
// necessary to do it this way because $a and $b are formulas when using an
Loading