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

Date pattern improvment #78

Closed
Jeffster2021 opened this issue May 12, 2021 · 5 comments
Closed

Date pattern improvment #78

Jeffster2021 opened this issue May 12, 2021 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@Jeffster2021
Copy link

Hey!

Entity class can map Db field of timestamp format to Date field.
It would be great to have the possibility to filter by that kind of field not only by date but by date and time both.
So for such cases, it would be needed to set the Date pattern as dd-MM-yyyy'T'HH:mm:ss.

Could you improve this?
Thanks.

@torshid
Copy link
Member

torshid commented May 12, 2021

Hello,

Not sure to have understood you but I think that you want to change date patterns. You may check this section of the readme to do that https://github.com/turkraft/spring-filter#date-format.

Or are you asking for Date fields to support multiple patterns at the same time?

@Jeffster2021
Copy link
Author

Jeffster2021 commented May 12, 2021

I'm asking to support a pattern containing time for Date fields. Or maybe support multiple patterns.

For example, we have a Postgres table
create table test(date_field timestamp);
So field contains date and time.

But the model entity is

@entity
class Test {
private Date dateField;
...
}

In this case, we can filter only by date value not considering the time.
Of course, it's possible to change the field in the model entity, but sometimes there are a lot of legacy code :)

@torshid
Copy link
Member

torshid commented May 12, 2021

In your application.properties, if you add

turkraft.springfilter.dateformatter.pattern=dd-MM-yyyy'T'HH:mm:ss

You should be able to filter using dateField : '12-05-2021T10:39:16'

@Jeffster2021
Copy link
Author

Thanks, you're a lifesaver.
I've read the doc page and tried it before, but maybe I was doing something wrong.
Sorry for wasting your time,

@torshid
Copy link
Member

torshid commented May 12, 2021

No problem. Feel free to open other issues.

@torshid torshid added the help wanted Extra attention is needed label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants