Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
75082eeb
Commit
75082eeb
authored
Jul 09, 2002
by
jouni%heikniemi.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 149246: Allow use of relative time units in query screen.
Patch by Michael Schindler <michael@compressconsult.com>, 2xr=jouni
parent
336bf13a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
buglist.cgi
buglist.cgi
+22
-0
No files found.
buglist.cgi
View file @
75082eeb
...
...
@@ -23,6 +23,7 @@
# Stephan Niemz <st.n@gmx.net>
# Andreas Franke <afranke@mathweb.org>
# Myk Melez <myk@mozilla.org>
# Michael Schindler <michael@compressconsult.com>
################################################################################
# Script Initialization
...
...
@@ -158,6 +159,27 @@ if ($::FORM{'cmdtype'} eq 'runnamed') {
sub
SqlifyDate
{
my
(
$str
)
=
@_
;
$str
=
""
if
!
defined
$str
;
if
(
$str
=~
/^-?(\d+)([dDwWmMyY])$/
)
{
# relative date
my
(
$amount
,
$unit
,
$date
)
=
(
$1
,
lc
$2
,
time
);
my
(
$sec
,
$min
,
$hour
,
$mday
,
$month
,
$year
,
$wday
)
=
localtime
(
$date
);
if
(
$unit
eq
'w'
)
{
# convert weeks to days
$amount
=
7
*
$amount
+
$wday
;
$unit
=
'd'
;
}
if
(
$unit
eq
'd'
)
{
$date
-=
$sec
+
60
*
$min
+
3600
*
$hour
+
24
*
3600
*
$amount
;
return
time2str
(
"%Y-%m-%d %H:%M:%S"
,
$date
);
}
elsif
(
$unit
eq
'y'
)
{
return
sprintf
(
"%4d-01-01 00:00:00"
,
$year
+
1900
-
$amount
);
}
elsif
(
$unit
eq
'm'
)
{
$month
-=
$amount
;
while
(
$month
<
0
)
{
$year
--
;
$month
+=
12
;
}
return
sprintf
(
"%4d-%02d-01 00:00:00"
,
$year
+
1900
,
$month
+
1
);
}
return
undef
;
# should not happen due to regexp at top
}
my
$date
=
str2time
(
$str
);
if
(
!
defined
(
$date
))
{
my
$htmlstr
=
html_quote
(
$str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment