Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
pikelang
pike
Commits
392822f4
Commit
392822f4
authored
24 years ago
by
Mirar (Pontus Hagland)
Browse files
Options
Downloads
Patches
Plain Diff
dwim day search order fixed (22-02-2000 added, m/d/y before d/m/y)
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.18
parent
deb7afab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Calendar.pmod/YMD.pmod
+10
-6
10 additions, 6 deletions
lib/modules/Calendar.pmod/YMD.pmod
with
10 additions
and
6 deletions
lib/modules/Calendar.pmod/YMD.pmod
+
10
−
6
View file @
392822f4
...
...
@@ -2411,7 +2411,7 @@ TimeRange parse(string fmt,string arg)
nfmt=replace(nfmt,
({"%Y","%y","%M","%W","%D","%a","%e","%h","%m","%s","%p",
"%t","%f","%d","%z","%n"}),
({ALNU,ALNU,ALNU,"%d",
"%d"
,"%d",ALNU,"%d","%d","%d",AMPM,
({ALNU,ALNU,ALNU,"%d",
NUME
,"%d",ALNU,"%d","%d","%d",AMPM,
NUME,NUME,NUME,"%[-+0-9A-Za-z/]","%s"}));
array q=Array.map(replace(fmt,({"%*","%%"}),({"",""}))/"%",
lambda(string s){ return s[..0];})-({""});
...
...
@@ -2439,7 +2439,7 @@ TimeRange parse(string fmt,string arg)
m->Y=default_rules->language[f_year_number_from_name](m->Y);
if (!zero_type(m->Y) && m->D && (int)m->M)
low=m->day=cal->Day(m->Y,(int)m->M,m->D);
low=m->day=cal->Day(m->Y,(int)m->M,
(int)
m->D);
if (m->d)
{
...
...
@@ -2479,8 +2479,7 @@ TimeRange parse(string fmt,string arg)
m->week=low=m->year->week("w"+m->W);
if (!zero_type(m->D))
if (stringp(m->D)) return 0;
else m->day=low=(m->month||cal->Month())->day(m->D);
m->day=low=(m->month||cal->Month())->day((int)m->D);
else if (!zero_type(m->a))
m->day=low=m->year->day(m->a);
else if (!zero_type(m->e))
...
...
@@ -2573,6 +2572,7 @@ TimeRange parse(string fmt,string arg)
//! <pre>
//! <ref>parse</ref> format as in
//! "%y-%M-%D (%M) -W%W-%e (%e)" "2000-03-20 (Mar) -W12-1 (Mon)"
//! "%M%/%D/%y" "3/20/2000"
//! "%D%*[ /]%M%*[ /-,]%y" "20/3/2000" "20 mar 2000" "20/3 -00"
//! "%e%*[ ]%D%*[ /]%M%*[ /-,]%y" "Mon 20 Mar 2000" "Mon 20/3 2000"
//! "%y-%M-%D" "2000-03-20", "00-03-20"
...
...
@@ -2633,16 +2633,19 @@ Calendar.dwim_day("next monday");
array dwim_day_strings=
({"%y-%M-%D (%*s) -W%W-%e (%e)",
"%e%*[, ]%M%*[ ,]%D%*[ ,]%y",
"%y-%M-%D",
"%M/%D/%y",
"%D%*[ /]%M%*[- /,]%y",
"%M %D%*[- /,]%y",
"%e%*[, ]%D%*[a-z:]%*[ /]%M%*[-/ ,]%y",
"%y-%M-%D",
"-%y%*[ /]%D%*[ /]%M",
"-%y%*[ /]%M%*[ /]%D",
"%y%*[ /]%M%*[ /]%D",
"%y%*[ /]%D%*[ /]%M",
"%D%*[- /]%M",
"%M%*[- /]%D",
"%M-%D-%y",
"%D-%M-%y",
"%e%*[- /wv]%W%*[ -/]%y",
"%e%*[- /wv]%W",
"%d"});
...
...
@@ -2653,7 +2656,8 @@ cDay dwim_day(string day)
foreach ( dwim_day_strings,
string dayformat)
if ( (d=parse(dayformat,day)) ) return d;
if ( (d=parse(dayformat+"%n",day)) )
return d;
cDay t=Day();
if ( (d=parse("%e",day)) )
...
...
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