-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#405 method for date #510
#405 method for date #510
Conversation
current date, modify days and hours
add a method dateReplace, convert date placeholder in json to date string
int numSymbolIndex = replaceSub.indexOf("#"); | ||
if (replaceSub.contains("HOURS#")){ | ||
if (replaceSub.contains("+")){ | ||
time = df.format(new Date(date.getTime() + modifiedNum*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
int numSymbolIndex = replaceSub.indexOf("#"); | ||
if (replaceSub.contains("HOURS#")){ | ||
if (replaceSub.contains("+")){ | ||
time = df.format(new Date(date.getTime() + modifiedNum*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
} | ||
else{ | ||
if (replaceSub.contains("+")){ | ||
time = df.format(new Date(date.getTime() + modifiedNum*24*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
} | ||
else{ | ||
if (replaceSub.contains("+")){ | ||
time = df.format(new Date(date.getTime() + modifiedNum*24*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
|
||
//check if date placeholder exists | ||
if (replaceIndex >= 0){ | ||
Date date = new Date(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
time = df.format(new Date(date.getTime() + modifiedNum*60*60*1000)); | ||
} | ||
else if(replaceSub.substring(numSymbolIndex+1, numSymbolIndex+2).equals("-")){ | ||
time = df.format(new Date(date.getTime() - modifiedNum*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
time = df.format(new Date(date.getTime() + modifiedNum*60*60*1000)); | ||
} | ||
else if(replaceSub.substring(numSymbolIndex+1, numSymbolIndex+2).equals("-")){ | ||
time = df.format(new Date(date.getTime() - modifiedNum*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
time = df.format(new Date(date.getTime() + modifiedNum*24*60*60*1000)); | ||
} | ||
else if(replaceSub.substring(numSymbolIndex+1, numSymbolIndex+2).equals("-")){ | ||
time = df.format(new Date(date.getTime() - modifiedNum*24*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
time = df.format(new Date(date.getTime() + modifiedNum*24*60*60*1000)); | ||
} | ||
else if(replaceSub.substring(numSymbolIndex+1, numSymbolIndex+2).equals("-")){ | ||
time = df.format(new Date(date.getTime() - modifiedNum*24*60*60*1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
String format = replaceSub.substring(formatIndex, replaceSub.length()-1); | ||
df= new SimpleDateFormat(format); | ||
df.setTimeZone(TimeZone.getTimeZone("GMT")); | ||
time = df.format(new Date(date.getTime())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
String format = replaceSub.substring(formatIndex, replaceSub.length()-1); | ||
df= new SimpleDateFormat(format); | ||
df.setTimeZone(TimeZone.getTimeZone("GMT")); | ||
time = df.format(new Date(date.getTime())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaUtilDate: Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. (details)
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
Hi, thanks. As I have written here, can you please add links how is it solve in the libraries like Wiremock? |
Support date placeholder in comparison. Though a better way is to modify Diff and configuration, it is more complicated.