User profile fields date picker with persian calendar

Re: User profile fields date picker with persian calendar

by Amin Farajzadeh -
Number of replies: 1
  • First I install persian calendar
  • I add a custom profile field to get Date of birth of users
  • In this case users can pick a date (solar date)
  • when a user wants to save profile settings
  • date changes automatically
  • and saves a negative number for time in DB


But I found my answer . the profilefield_datetime  plugin uses min and max date based on Gregorian calendar . I fixed my problem by convert to Gregorian date before processing date :

In profilefield_datetime and in field.class.php and in "edit_save_data_preprocess" method I replaced This line :

$datetime = userdate($datetime, '%Y-%m-%d-%H-%M-%S');

by

$datetime = date('Y-m-d-H-m-s', $datetime);


In reply to Amin Farajzadeh

Re: User profile fields date picker with persian calendar

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Hmm, so that sounds like a bug in that profile field code. Have you checked the tracker if it has been reported, and can you eventually report it as a new issue? Thanks.