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

New option for custom formatRangeForDisplay function. #86

Open
prototype23 opened this issue Oct 11, 2017 · 1 comment
Open

New option for custom formatRangeForDisplay function. #86

prototype23 opened this issue Oct 11, 2017 · 1 comment

Comments

@prototype23
Copy link

prototype23 commented Oct 11, 2017

A new option 'formatRangeForDisplay' would be helpful. Especially when displaying dates in diff timezone than local.

	function formatRangeForDisplay(range) {
			var dateFormat = options.dateFormat;

			if (typeof options.formatRangeForDisplay === 'function') {
				return options.formatRangeForDisplay();
			} else {
				return $.datepicker.formatDate(dateFormat, range.start) + (+range.end !== +range.start ? options.rangeSplitter + $.datepicker.formatDate(dateFormat, range.end) : '');
			}
		}
@prototype23
Copy link
Author

prototype23 commented Oct 12, 2017

Well i think this might not be necessary. I was using an altField '@' (timestamp) and my custom preset ranges were parsing the date on the target timezone.

This proved wrong because jQuery datepicker works on local time only. For the story, while the timestamps on the original element value were generated ok, the calendar, when the local timezone was different from the target timezone, was selecting other dates..

I now use an altField: 'yy-mm-dd' and i parse the date on my target timezone only at the end, at the point i want to use the result.

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