Inconsistent date between datatables and editor instance

Inconsistent date between datatables and editor instance

Stacey1134Stacey1134 Posts: 112Questions: 20Answers: 0

Ok, this is one that will not give an error message so here's the code.

Some how I am getting a different date from editor and inline datatables, Newsflash! it's the same field.

This is the field in in my ajax call :

    Editor::inst( $db, 'scanned_mail' )
    ->fields(
        Field::inst( 'scanned_mail.postmark_date' ),

This is the field in my editor:

}, {
      label: "Postmark Date:",
      name:  "scanned_mail.postmark_date",
      type: 'datetime',
             def: function () { return new Date(); },
             displayFormat: "M/D/YYYY",
             wireFormat: "YYYY-MM-DD",
             fieldInfo: "US style m/d/y format",
             keyInput: false                        
}, {  

This is the field for inline datatables:

columns: [
           {data: "scanned_mail.postmark_date", render: DataTable.render.datetime( 'M/D/YYYY' )},

And the table structure:

--
-- Table structure for table `scanned_mail`
--

CREATE TABLE `scanned_mail` (
  `id` mediumint(8) UNSIGNED NOT NULL,
  `cr_id` int(11) DEFAULT NULL,
  `category` varchar(50) DEFAULT NULL,
  `priority` varchar(50) DEFAULT NULL,
  `postmark_date` date DEFAULT NULL,
  `campaign` varchar(255) DEFAULT NULL,
  `attention` varchar(255) DEFAULT NULL,
  `pe_choice1` int(11) DEFAULT NULL,
  `pe_choice2` int(11) DEFAULT NULL,
  `notes` text,
  `scanner` varchar(255) DEFAULT NULL,
  `date_entered` date DEFAULT NULL,
  `date_answered` date DEFAULT NULL,
  `answered_by` varchar(255) DEFAULT NULL,
  `image` int(11) DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT NULL,
  `chapter` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

While the inline datatables shows the date as 3/20/23, the editor instance shows 3/19/23

Suggestions?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    There was an issue with the DateTime library that would cause exactly this problem. What version are you using? The latest 1.4.0 release should work correct (fix was in this commit).

    If that doesn't resolve it, can you give me a link to your page so I can dig into it please?

    Thanks,
    Allan

  • Stacey1134Stacey1134 Posts: 112Questions: 20Answers: 0
    edited March 2023

    Yup! That did it, thanks! I saw I was still linked to 1.3.0

Sign In or Register to comment.