Skip to content
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

Add methods for dates #405

Open
NewbieProger opened this issue Jul 27, 2021 · 7 comments
Open

Add methods for dates #405

NewbieProger opened this issue Jul 27, 2021 · 7 comments

Comments

@NewbieProger
Copy link

Please, add follow:

  1. ${json-unit.current-date.format:yyyy-MM-dd} - current date and change format
  2. ${json-unit.current-date.DAYS#+1} - take current date and add some days, hours, or monthes
  3. ${json-unit.current-date.DAYS#+1.format:yyyy-MM-dd} - take current date and add/remove some days, hours, or monthes WITH formatting
  4. ${json-unit.current-date.HOURS#-1.format:yyyy-MM-dd} - take current date and remove some hours WITH formatting
@lukas-krecan
Copy link
Owner

Hi, thanks for feedback. I do not think this is a use-case so common that it should be part of the library. Luckily, you can implement it yourself using custom matchers

@NewbieProger
Copy link
Author

NewbieProger commented Jul 27, 2021

I think its so, beacuse wiremock uses ur library.
http://wiremock.org/docs/request-matching/ -> Placeholders

It is used in many companies, in many frameworks and everyone has to write custom matchers.
Wiremock is used for API testing. The API is tested in each company that has an API. Now microservices are popular, and therefore API testing, where Wiremock is used, which uses your library.
And a huge number of requests pass the dates, and in order not to change every day of the date, we all need this pattern

@NewbieProger
Copy link
Author

So, and here i found one more same request :)
wiremock/wiremock#964

@rgseyvie
Copy link

@NewbieProger
@lukas-krecan
If this issue still needs solving, I' d like to take it.

@NewbieProger
Copy link
Author

@NewbieProger @lukas-krecan If this issue still needs solving, I' d like to take it.

Yes, I need

@lukas-krecan
Copy link
Owner

@rgseyvie Hi, feel free to try it. But before you begin, can you please

  1. Describe the format how the matcher is going to be configured
  2. Check similar libraries like Wiremock how they solve it and how it's configured so we do not have to reinvent the wheel

@NewbieProger
Copy link
Author

and add formats with seconds, millisecondes. With timezone and some else examples))

rgseyvie added a commit to rgseyvie/JsonUnit that referenced this issue Apr 24, 2022
current date, modify days and hours
rgseyvie added a commit to rgseyvie/JsonUnit that referenced this issue Apr 24, 2022
add a method dateReplace, convert date placeholder in json to date string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants