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

[FR] use another date picker for other calendar types #5001

Open
vnali opened this issue Sep 26, 2019 · 2 comments

Comments

@vnali
Copy link
Contributor

commented Sep 26, 2019

Craft CMS calendar is a jquery ui calendar and it only translates calendar for different languages in:
https://github.com/craftcms/cms/blob/develop/src/web/assets/datepickeri18n/DatepickerI18nAsset.php
but translation is not always useful. some authors don't know Gregorian format well.
In other content management systems like Drupal or Wordpress, we can have different calendar systems by patching core or 3rd party modules.

I tried this steps only for demonstration and i was able to show user a Persian calendar.

if (isset($datepickerLanguage)=="fa") {
	$this->css = [
	  'persianDatepicker-default.css'
	];
	$this->js = [
		"persianDatepicker.js",
	];
}

to DatepickerI18nAsset.php

    $('#{{ id|namespaceInputId|e('js') }}').persianDatepicker({
		showGregorianDate: true, //select from Persian calendar but convert it to Gregorian when user selected the desire date
		formatDate: "YYYY/MM/DD",
	});

and i have this calendar which author knows well (he sees year, month, day in Persian calendar system like 1398/07/04)
calendar (2)

but there are some problems:

  • i have changed the core!
  • currently Craft CMS passes data in Gregorian format, so date has to be converted to Gregorian after the user picks a date - in my example, after user click on 1398//07/04, calendar returns 2019/09/26 and not every calendar library does that conversion.
    so best solution is not only allow users to picks a date in other calendar systems, also showing that selected date in another calendar systems and pass Gregorian date in background-.
  • finding a robust and well-maintained calendar library is difficult. i am not sure if the library i used, is going to work for next years or not.

at last i think that is not possible for Craft CMS team to find a robust calendar library for every calendar systems and hard code it in Craft CMS.
but maybe it is not a bad idea to:

  • let users to find their favorite calendar library -and of course they have to accept the risk of custom calendar library- and define them via assets and add them to project by some settings.
  • let users to change calendar date picker by create calendar type plugins -
@vnali vnali changed the title use another date picker for other calendars use another date picker for other calendar types Sep 26, 2019
@vnali vnali changed the title use another date picker for other calendar types [FR] use another date picker for other calendar types Oct 10, 2019
@vnali

This comment has been minimized.

Copy link
Contributor Author

commented Oct 10, 2019

this feature is kind of related to #5000. is there any chance to have this feature @brandonkelly?

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Oct 11, 2019

Yep, also in the works for 3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.