Tuesday 15 June 2010

regex - RegExp for dates Extjs 3.4 -


I have trouble creating regExp for search panel

  & amp; Amp; (Item.Get ('prompt')> date = dateStartValue.format ("Y-M-D") & amp; Amp; (Item.get ('prodAddDate') & lt; = dateEndValue.format ("Y-M-D"));   

I'm not sure that this is work for refExp, but I do not have any other ideas

The problem is that when I can not fill the field with the date I can not filter data with other conditions

I was trying something like this but not working

  & amp; ((Item.get ('prodAddDate') & gt; dateStartValue.format ("Y-M-D")) (New RegExp (dateStartValue). Exam (item.get ('prodAddDate')) & Amp; Amp; ((Item.get ('prodAddDate') & lt; = dateEndValue.format ("Y-M-D")) || (New RegExp). Test (item.get ('prodAddDate'));    

Not entirely sure what you are trying to do, but Here are some pieces of information that I hope can help you solve your problem.

Priority of comparison operators

and operator priority || , which means that:

  A || B & amp; C || D is equivalent to   

:

  A || (B & amp; c) || D   

No:

  (A || B) & amp; Amp; (C) || Date comparison  

You can compare objects directly to date : Code> // example data var d1 = new date ('2012-12-12'), D2 = new date ('2012-12-12'), d3 = new date ('2013-01-01') ;

and you & lt; , & gt; , & lt; = , and & gt; = :

  // logical results D1 & lt; D3 / True D1 & Lt; D2 / False D2 & gt; D3 / false D1 and LT; = D2 / true D1 = & gt; D2 // true   

but not comparing equality with == :

  d1 == d2 // still Wrong // ... D1 and LT; = D2 & amp; D1 = & gt; D2 // True   

Conclusion: To test that a date before or after a date, direct comparison is OK. But, if the two dates are the same, then compare the string to test it:

  // Is that the same day? D1.format ('y-m-d') === d2.format ('y-m-d') // True // Is this the same day and hour? D1.format ('Ymd H: i: s') === d2.format ('Ymd H: i: s') // true   

Ext.isEmpty () null , undefined and empty string '' only
  Ext.isEmpty (Empty) // True Ext.isEmpty (Undefined) // True Ext.isEmpty ('') // True Ext.isEmpty ('') / / False Ext.isEmpty (false) // false // etc.   

This can be useful for addressing your blank field case:

  ... & amp; & Amp; (Ext. Istity (Ietate.Gate ('ProdaidDate'). Item () ('Promoded') & gt; = DataStart Value) & amp; Ent.ISTT (iTet.Jet (ProdaidDate) || 'ProdAddDate') & lt; = dateEndValue)   

Finally

about regex What is this obsession? They are useful for testing / removing complex strings, but this is all you should forget about them for a little while, dude, p

No comments:

Post a Comment