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

Custom date and time format #41

Merged
merged 7 commits into from
Mar 13, 2018
Merged

Conversation

benoitchantre
Copy link
Contributor

Use the date and time format from the settings

Use the date and time format from the settings
@benoitchantre
Copy link
Contributor Author

The date and time format aren't internationalized yet in the edit view.

@benoitchantre
Copy link
Contributor Author

Date Month Year format can be set with add_filter( 'be_event_set_dmy_format', '__return_true' );
24 hour clock can be set with add_filter( 'be_event_set_24_hour_clock', '__return_true' );

For colums, custom formats can be used too with the following filters:

  • be_event_columns_date_format
  • be_event_columns_time_format

@benoitchantre
Copy link
Contributor Author

@billerickson Let me know if you some improvements should be done.

@benoitchantre
Copy link
Contributor Author

Custom date and time format for calendar view and widget calendar are not done at the moment.

@benoitchantre benoitchantre changed the title List view: localize date and time Custom date and time format Feb 28, 2018
@billerickson
Copy link
Owner

Instead of having a true/false filter to swap between date formats, why not make the format itself filterable?

$date_format    = apply_filters( 'be_events_calendar_date_format', 'm/d/Y' );

That way you can change it to any format you prefer - you're not limited to two choices.

@benoitchantre
Copy link
Contributor Author

Because we have different constraints based on the location where the date is displayed :

  • columns: we can display the format we want
  • fields: we don't have much space and the datepicker doesn't accept all formats

For the event list, there are 2 filters :

  • be_event_columns_date_format
  • be_event_columns_time_format

Let me know if it makes sense or if we should replace be_event_set_dmy_format, by something like could bebe_event_field_date_format which would accept a custom date format (same principle for time format).

@benoitchantre
Copy link
Contributor Author

If you have a bit of time @billerickson, can we discuss further to find the best way to handle that? I don't know if you have seen my last comment and if you agree or not with my explanation.

@billerickson
Copy link
Owner

Sorry for the delay. Yes, that makes sense to me.

@billerickson billerickson merged commit be21bc1 into billerickson:master Mar 13, 2018
@benoitchantre
Copy link
Contributor Author

Thank you for having checked that.

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

Successfully merging this pull request may close these issues.

2 participants