Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99235609
PhabricatorSearchDateField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jan 22, 15:45
Size
849 B
Mime Type
text/x-php
Expires
Fri, Jan 24, 15:45 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
23736026
Attached To
rPH Phabricator
PhabricatorSearchDateField.php
View Options
<?php
final
class
PhabricatorSearchDateField
extends
PhabricatorSearchField
{
protected
function
newControl
()
{
return
new
AphrontFormTextControl
();
}
protected
function
getValueFromRequest
(
AphrontRequest
$request
,
$key
)
{
return
$request
->
getStr
(
$key
);
}
public
function
getValueForQuery
(
$value
)
{
return
$this
->
parseDateTime
(
$value
);
}
protected
function
validateControlValue
(
$value
)
{
if
(!
strlen
(
$value
))
{
return
;
}
$epoch
=
$this
->
parseDateTime
(
$value
);
if
(
$epoch
)
{
return
;
}
$this
->
addError
(
pht
(
'Invalid'
),
pht
(
'Date value for "%s" can not be parsed.'
,
$this
->
getLabel
()));
}
protected
function
parseDateTime
(
$value
)
{
if
(!
strlen
(
$value
))
{
return
null
;
}
return
PhabricatorTime
::
parseLocalTime
(
$value
,
$this
->
getViewer
());
}
}
Event Timeline
Log In to Comment