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.
Sign In
Not a member yet? Click here to register.

Datetimepicker

i have this:

CodeDownload  
// 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:
CodeDownload  
echo "<div class='input-group date' style='width: 520px;'>".$data['figure_pubdate']."</div></font>";

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

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
Catzenjaeger attached the following file:
admin_figurelib.zip [14.79kB / 112 Downloads]
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)

CodeDownload  
// 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

CodeDownload  
            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"
            )            
            
            );   

Catzenjaeger attached the following file:
admin_figurelib_1.zip [14.79kB / 120 Downloads]
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.
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
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:
CodeDownload  
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.
CodeDownload  
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>");
}

Thread Information
Author
Replies
7 posts
Views
1492 times
Last Post
Last updated on 3 years ago
Related Threads
Datetimepicker
Started by
C
Catzenjaeger - 7 posts
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Catzenjaeger, Chan, RobiNN