Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F959715
PhabricatorCalendarHoliday.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorCalendarHoliday.php
View Options
<?php
final
class
PhabricatorCalendarHoliday
extends
PhabricatorCalendarDAO
{
protected
$day
;
protected
$name
;
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_TIMESTAMPS
=>
false
,
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'day'
=>
'date'
,
'name'
=>
'text64'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'day'
=>
array
(
'columns'
=>
array
(
'day'
),
'unique'
=>
true
,
),
),
)
+
parent
::
getConfiguration
();
}
public
static
function
getNthBusinessDay
(
$epoch
,
$n
)
{
// Sadly, there are not many holidays. So we can load all of them.
$holidays
=
id
(
new
PhabricatorCalendarHoliday
())->
loadAll
();
$holidays
=
mpull
(
$holidays
,
null
,
'getDay'
);
$interval
=
(
$n
>
0
?
1
:
-
1
)
*
24
*
60
*
60
;
$return
=
$epoch
;
for
(
$i
=
abs
(
$n
);
$i
>
0
;
)
{
$return
+=
$interval
;
$weekday
=
date
(
'w'
,
$return
);
if
(
$weekday
!=
0
&&
$weekday
!=
6
&&
// Sunday and Saturday
!
isset
(
$holidays
[
date
(
'Y-m-d'
,
$return
)]))
{
$i
--;
}
}
return
$return
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 10:26 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
228521
Default Alt Text
PhabricatorCalendarHoliday.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment