Skip to content

Commit

Permalink
Merge pull request #90 from messai-engineering/current
Browse files Browse the repository at this point in the history
YugaV1.61 || IlTicket Changes
  • Loading branch information
saxena-saumittra authored Jan 17, 2024
2 parents 077c264 + 45ab2be commit 8fe3abe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>in.messai</groupId>
<artifactId>yuga</artifactId>
<version>1.0.60</version>
<version>1.0.61</version>

<name>Yuga Date Parser</name>
<description>
Expand Down Expand Up @@ -188,7 +188,7 @@
<developerConnection>scm:git:[email protected]:messai-engineering/Yuga.git</developerConnection>
<url>https://github.com/messai-engineering/Yuga</url>

<tag>yuga-1.0.60</tag>
<tag>yuga-1.0.61</tag>

</scm>
</project>
7 changes: 6 additions & 1 deletion src/main/java/com/twelfthmile/yuga/Yuga.java
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,8 @@ else if (str.charAt(j) == 'x' && ((j + 1) == str.length() || ((j + 1) < str.leng
setIfNumRange(str, i, map);
if (map.getType().equals(Constants.TY_NUM)) {
int k = i + skip(str.substring(i));
// IL-748
boolean containsStartBracket = k < str.length() && str.substring(i,k).contains("{") || str.substring(i,k).contains("[") || str.substring(i,k).contains("(");
// Added last char is not space check that prevents 'num' becoming a 'str'. Ex: "+919057235089 pin"
if(k < str.length() && ((str.charAt(k) == 'k' || str.charAt(k) == 'm' || str.charAt(k) == 'g') && (k + 1) < str.length() && str.charAt(k + 1) == 'b')) {
checkIfData(str, k, map);
Expand All @@ -1187,7 +1189,7 @@ else if (str.charAt(j) == 'x' && ((j + 1) == str.length() || ((j + 1) < str.leng
i = k + 4;
map.setType(Constants.TY_NUM_MINS);
map.getValMap().put("minutes_num",map.get("NUM"));
} else if(!configContextIsCURR(config) && YugaMethods.isCurrencyAhead(str.substring(k))) {
} else if(!configContextIsCURR(config) && !(containsStartBracket) && YugaMethods.isCurrencyAhead(str.substring(k))) {
map.setType(Constants.TY_AMT, Constants.TY_AMT);
map.getValMap().put("currency",YugaMethods.getPotentialCurrString(str.substring(k)));
i = k + 3;
Expand Down Expand Up @@ -1368,6 +1370,9 @@ else if (map.getType().equals(Constants.TY_NUMRANGE)) {
}

private static void setIfNumRange(String str, int i, FsaContextMap map) {
// TCANDROID-52501 - introduce bound checks
if((str.isEmpty() || str==null) || str.length()<=i)
return;
String trimmed = str.substring(0, i).trim();
// 18-22.
if(Util.isDelimiter(trimmed.charAt(trimmed.length()-1))){
Expand Down

0 comments on commit 8fe3abe

Please sign in to comment.