JsonUnit icon indicating copy to clipboard operation
JsonUnit copied to clipboard

Add methods for dates

Open NewbieProger opened this issue 3 years ago • 7 comments

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

NewbieProger avatar Jul 27 '21 17:07 NewbieProger

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

lukas-krecan avatar Jul 27 '21 17:07 lukas-krecan

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 avatar Jul 27 '21 18:07 NewbieProger

So, and here i found one more same request :) https://github.com/tomakehurst/wiremock/issues/964

NewbieProger avatar Jul 28 '21 11:07 NewbieProger

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

rgseyvie avatar Mar 11 '22 09:03 rgseyvie

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

Yes, I need

NewbieProger avatar Mar 12 '22 03:03 NewbieProger

@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

lukas-krecan avatar Mar 13 '22 17:03 lukas-krecan

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

NewbieProger avatar Mar 13 '22 19:03 NewbieProger