Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

datetimepicker

Asked Modified Viewed 2,156 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

i have this:

// Get Empty Figure Datas
      $data = [   "figure_pubdate"  => ""];

// Handle posted Informations
      if (isset($_POST['save_figure'])) {
         $data = [   "figure_pubdate"       => stripinput(trim($_POST['figure_pubdate']))   ];

// Formfield "Figure Pubdate"
            echo form_datepicker('figure_pubdate', $locale['figurelib/admin/figurelib.php_047'], $data['figure_pubdate'],
            array(
               "placeholder" => $locale['figurelib/admin/figurelib.php_048'],
               "inline"       => true,
               "width"       => "250px"
            )

// Datepicker include
if (!defined('DATEPICKER')) {
   define('DATEPICKER', TRUE);
    add_to_head("<link href='".DYNAMICS."assets/datepicker/css/bootstrap-datetimepicker.min.css' rel='stylesheet' />");
    add_to_footer("<script src='".DYNAMICS."assets/datepicker/js/moment.min.js'></script>");
    add_to_footer("<script src='".DYNAMICS."assets/datepicker/js/bootstrap-datetimepicker.min.js'></script>");
    add_to_head("<script src='".DYNAMICS."assets/datepicker/locale/".$locale['datepicker'].".js'></script>");
}

// Add jQuery
$('#figure_pubdate-field .input-group.date').datetimepicker({
      showTodayButton: true,
      showClear: true,
      showClose: true,
      allowInputToggle: true,
      format: 'YYYY (MMMM)',
});


but the date will not shown.
--> this works:
echo "<div class='input-group date' style='width: 520px;'>".$data['figure_pubdate']."</div></font>";
Edited by Catzenjaeger on 30-10-2017 17:17,
0 replies

6 posts

R
Anonymous User
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
answered
Veteran Member

add_to_jquery("$('#figure_pubdate-field .input-group.date').datetimepicker({
      showTodayButton: true,
      showClear: true,
      showClose: true,
      allowInputToggle: true,
      format: 'YYYY (MMMM)',
});");
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

thanks for help. dosent work ... and i cant find the error. for some time it was working but since core update not anymore.
The datafield in my database is filled but the datapicker dosent load the date when the figure in my admin area. A member send me a figure via a submit form and i fill all missing data in admin area and puplish this figure. Have also security reason that a member not can publish via submit.

here the complete file: see attachment
Edited by Catzenjaeger on 01-11-2017 12:45,
Catzenjaeger attached the following file:
admin_figurelib.zip [No information available / 149 Downloads]
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

ok the date when i load the figure in admin area

now in my admin area: 1-01-1970 0:00:00
in my database field is: 2017 (November)
the content of my database would not be correct read and show
whats wrong?

ok i have made some tests

if i have this the date will correct load and show (but the code is old and wrong well i cant change the date - datapicker donsent work ... but the date will show what saved in databse)

// Formfield "Figure Pubdate"
echo "<div id='figure_pubdate-field' class='form-group'>\n";
      echo "<label class='control-label col-xs-12 col-sm-3 col-md-3 col-lg-3 p-l-0' for='figure_pubdate'>". $locale['figurelib/admin/figurelib.php_047']."</label>\n";
      echo "<div class='col-xs-12 col-sm-9 col-md-9 col-lg-9'>\n";
         echo "<div class='input-group date' style='width: 520px;'>\n";
            echo "<input type='text' name='figure_pubdate' id='figure_pubdate' value='".$data['figure_pubdate']."' class='form-control textbox' placeholder='".$locale['figurelib/admin/figurelib.php_048']."' />\n";
            echo "<span class='input-group-addon'><i class='entypo calendar'></i></span>\n";
         echo "</div>\n";
      echo "</div>\n";
   echo "</div>\n";


this code show only 1-01-1970 0:00:00 and not the right date was stores

            echo form_datepicker('figure_pubdate', $locale['figurelib/admin/figurelib.php_047'], $data['figure_pubdate'],
            array(
               "placeholder" => $locale['figurelib/admin/figurelib.php_048'],
               "inline"       => true,
               "width"       => "250px"
            )            
            
            );   
Edited by Catzenjaeger on 01-11-2017 13:33,
Catzenjaeger attached the following file:
admin_figurelib_1.zip [No information available / 160 Downloads]
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

See the file, there is a very important section

* Callback Usages !important
* ==========================
* Configuration when type is 'timestamp'
* Token used for $options['date_format_php'] is the <a href="http://php.net/manual/en/function.date.php">PHP token equivalent.</a>
* Token used for $options['date_format_js'] must be formatted with <a href="http://momentjs.com/docs/#/displaying/">moment.js.</a>
* Both token must match each other to parse the callback properly.

Pass your options in for both php and js to have them properely stored into the db and callback display.
SQL field must be INT(10) for all scenarios.
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

Tanks Chan ... but what i not understand ... datapiker is a global function in PHPF .. at other places it will works

this is waht i have in my file:

if (!defined('DATEPICKER'wink) {
define('DATEPICKER', TRUE);
add_to_head("<link href='".DYNAMICS."assets/datepicker/css/bootstrap-datetimepicker.min.css' rel='stylesheet' />"wink;
add_to_footer("<script src='".DYNAMICS."assets/datepicker/js/moment.min.js'></script>"wink;
add_to_footer("<script src='".DYNAMICS."assets/datepicker/js/bootstrap-datetimepicker.min.js'></script>"wink;
add_to_head("<script src='".DYNAMICS."assets/datepicker/locale/".$locale['datepicker'].".js'></script>"wink;
}

the links are right .... where is now my Problem? It must work ..
can you tell me step by step what i have to do please?
It have work Long time ... but from one day of other after a core update not anymore
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

You are getting me wrong or I did not understand your nature of your question.

Are you trying to get "date" or "timestamp"?

A timestamp is 11/06/2017 @ 5:06am (UTC) =======> 1509944784
A date is 11/06/2017

The new datepicker defaults to seconds. People just want it that way after multiple git fixes. If you want to see without seconds.

Do this:
echo form_datepicker('user_birthdate', '', $value, [
                            'showTime'        => FALSE,
                            'date_format_js'  => 'YYYY-M-DD',
                            'date_format_php' => 'Y-m-d',
                            'width'           => '100%',
'inner_width' => '100%']);



Where is this placed on? Nobody should do this in their custom file since them path will change when we update our code base. Remove it from your infusion.
if (!defined('DATEPICKER')) {
define('DATEPICKER', TRUE);
add_to_head("<link href='".DYNAMICS."assets/datepicker/css/bootstrap-datetimepicker.min.css' rel='stylesheet' />");
add_to_footer("<script src='".DYNAMICS."assets/datepicker/js/moment.min.js'></script>");
add_to_footer("<script src='".DYNAMICS."assets/datepicker/js/bootstrap-datetimepicker.min.js'></script>");
add_to_head("<script src='".DYNAMICS."assets/datepicker/locale/".$locale['datepicker'].".js'></script>");
}
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
R
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet