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

[StringHelpers] Add support for Calendar in dateFormat #1079

Open
LeBezout opened this issue Oct 12, 2023 · 0 comments
Open

[StringHelpers] Add support for Calendar in dateFormat #1079

LeBezout opened this issue Oct 12, 2023 · 0 comments

Comments

@LeBezout
Copy link

Hi,

In com.github.jknack.handlebars.helper.StringHelpers for the dateFormat helper we can add the support for (the good old) Calendar as already exists for (the good old) Date :

Actual :

private TemporalAccessor toTemporalAccessor(final Object value) {
  if (value instanceof TemporalAccessor) {
	return (TemporalAccessor) value;
  } else if (value instanceof Date) {
	return ((Date) value).toInstant();
  } else {
	// ...
}

Proposal :

private TemporalAccessor toTemporalAccessor(final Object value) {
  if (value instanceof TemporalAccessor) {
	return (TemporalAccessor) value;
  } else if (value instanceof Date) {
	return ((Date) value).toInstant();
  } else if (value instanceof Calendar) {
	return ((Calendar) value).toInstant();
  } else {
	// ...
}
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

1 participant