Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
14e17ba0
Commit
14e17ba0
authored
3 years ago
by
Eric Bremner
Committed by
Igor Biki
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4917: adding common function to get a date format
parent
6ddd1289
No related branches found
No related tags found
1 merge request
!118
Feature/istwcms 4917 ebremner upcoming dates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Service/UWService.php
+29
-21
29 additions, 21 deletions
src/Service/UWService.php
src/Service/UWServiceInterface.php
+13
-0
13 additions, 0 deletions
src/Service/UWServiceInterface.php
with
42 additions
and
21 deletions
src/Service/UWService.php
+
29
−
21
View file @
14e17ba0
...
@@ -639,33 +639,41 @@ class UWService implements UWServiceInterface {
...
@@ -639,33 +639,41 @@ class UWService implements UWServiceInterface {
// Ensure that the dates are greater than timestamp
// Ensure that the dates are greater than timestamp
// that we generated above.
// that we generated above.
if
(
$date
[
'end_value'
]
>
$check_date
)
{
if
(
$date
[
'end_value'
]
>
$check_date
)
{
$return_dates
[]
=
$this
->
UwGetDate
(
$date
,
'event'
);
}
}
}
// The all day case, duration is always 1439.
return
$return_dates
;
if
(
$date
[
'duration'
]
==
'1439'
)
{
}
$return_dates
[]
=
date
(
'l, F j, Y'
,
$date
[
'value'
])
.
' (all day)'
;
}
else
{
// If this is the same day, get the date and the start
/**
// and end times.
* {@inheritDoc}
if
(
$date
[
'duration'
]
<
'1439'
)
{
*/
$start_date
=
date
(
'l, F j, Y g:i A'
,
$date
[
'value'
]);
public
function
uwGetDate
(
array
$date
,
string
$type
):
string
{
$end_date
=
date
(
'g:i A'
,
$date
[
'end_value'
]);
}
// This is not the day, get the start and end date with time.
else
{
$start_date
=
date
(
'l, F j, Y g:i A'
,
$date
[
'value'
]);
$end_date
=
date
(
'l, F j, Y g:i A'
,
$date
[
'end_value'
]);
}
// Add the start and end date with timezone.
// The all day case, duration is always 1439.
$return_dates
[]
=
$start_date
.
' - '
.
$end_date
.
' '
.
date
(
'T'
,
$date
[
'end_value'
]);
if
(
$date
[
'duration'
]
==
'1439'
)
{
}
$return_date
=
date
(
'l, F j, Y'
,
$date
[
'value'
])
.
' (all day)'
;
}
}
else
{
// If this is the same day, get the date and the start
// and end times.
if
(
$date
[
'duration'
]
<
'1439'
)
{
$start_date
=
date
(
'l, F j, Y g:i A'
,
$date
[
'value'
]);
$end_date
=
date
(
'g:i A'
,
$date
[
'end_value'
]);
}
// This is not the day, get the start and end date with time.
else
{
$start_date
=
date
(
'l, F j, Y g:i A'
,
$date
[
'value'
]);
$end_date
=
date
(
'l, F j, Y g:i A'
,
$date
[
'end_value'
]);
}
}
// Add the start and end date with timezone.
$return_date
=
$start_date
.
' - '
.
$end_date
.
' '
.
date
(
'T'
,
$date
[
'end_value'
]);
}
}
return
$return_date
s
;
return
$return_date
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
+
13
−
0
View file @
14e17ba0
...
@@ -93,6 +93,19 @@ interface UWServiceInterface {
...
@@ -93,6 +93,19 @@ interface UWServiceInterface {
*/
*/
public
function
uwGetDates
(
Node
$node
,
string
$field_name
):
array
;
public
function
uwGetDates
(
Node
$node
,
string
$field_name
):
array
;
/**
* Get a date in the proper format.
*
* @param array $date
* An array of date info.
* @param string $type
* The type of date.
*
* @return string
* A converted date to a string.
*/
public
function
uwGetDate
(
array
$date
,
string
$type
):
string
;
/**
/**
* Gets image from node.
* Gets image from node.
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment