mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Parser.Date: Parse times with format of 'm/d/yyyy' where d == 13
This commit is contained in:
parent
efae8aff51
commit
b43ec6d2e2
@ -35,6 +35,7 @@ public class Pft_func_time__basic__tst {
|
||||
@Test public void Utc_ym() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|201201}}" , "2012-01-02");} // PURPOSE: default to today's date
|
||||
@Test public void Utc_md() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|2-13}}" , "2012-02-13");} // PURPOSE.fix: m-d failed
|
||||
@Test public void Slashes() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|2/13/12}}" , "2012-02-13");} // PURPOSE: assert slashes work
|
||||
@Test public void Slashes_yyyy() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|2/13/2012}}" , "2012-02-13");} // PURPOSE: assert slashes work with yyyy; DATE:2017-04-25
|
||||
@Test public void Utc_day() {fxt.Test_parse_tmpl_str("{{#time:Y-m-d|March 27}}" , "2012-03-27");}
|
||||
@Test public void Parse_day() {fxt.Test_parse_tmpl_str("{{#time:m d|March 27}}" , "03 27");}
|
||||
@Test public void Month_name() {fxt.Test_parse_tmpl_str("{{#time:M|May 1 2012}}" , "May");}
|
||||
|
@ -42,7 +42,7 @@ class Pxd_eval_year {
|
||||
Pxd_itm_int itm_0 = Pxd_itm_int_.CastOrNull(data_ary[0]);
|
||||
Pxd_itm_int itm_1 = Pxd_itm_int_.CastOrNull(data_ary[1]);
|
||||
if (itm_0 == null || itm_1 == null) return; // 0 or 1 is not an int;
|
||||
if (itm_1.Val() > 13) {
|
||||
if (itm_1.Val() > 12) { // if itm_1 is > 12 then can't be month; must be day; PAGE:en.d:tongue-in-chic DATE:2017-04-25
|
||||
if (!Pxd_eval_seg.Eval_as_m(tctx, itm_0)) return;
|
||||
if (!Pxd_eval_seg.Eval_as_d(tctx, itm_1)) return;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class Scrib_lib_ustring implements Scrib_lib {
|
||||
if (rv.Pattern_is_invalid()) {
|
||||
// try to identify [z-a] errors; PAGE:https://en.wiktionary.org/wiki/Module:scripts/data; DATE:2017-04-23
|
||||
Exception exc = rv.Pattern_is_invalid_exception();
|
||||
ctx.App().Usr_dlg().Warn_many("", "", "regx is invalid: regx=~{0} page=~{1} exc={2}", regx, ctx.Page().Ttl().Page_db(), Err_.Message_gplx_log(exc));
|
||||
ctx.App().Usr_dlg().Log_many("", "", "regx is invalid: regx=~{0} page=~{1} exc=~{2}", regx, ctx.Page().Ttl().Page_db(), Err_.Message_gplx_log(exc));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user