Grid value shows false

QuestionsGrid value shows false
Jonathan asked 2 years ago

Hi

Inside the “filter_display” loop I am converting an integer value in minutes to a date/time:

$yourDate = new DateTime(‘2021-01-01 00:00:00’);
$interval = new DateInterval(“PT{$d[“departureTime”]}M”);
$yourDate->add($interval);
$d[“departureTime”]= $yourDate;

This returns a value in the format e.g. 2021-01-05 14:40:00.000000

I have the ‘departureTime’ col set up as below:

$col = array();
$col[“title”] = “Dep Time (Local)”;
$col[“name”] = “departureTime”;
$col[“visible”] = “xs+”; // show on small screens
$col[“editable”] = true;
$col[“formatter”] = “datetime”;
$col[“formatoptions”] = array(“srcformat”=>’Y-m-d H:i:s.v’,”newformat”=>’H:i’,
“opts” => array(“timeOnly” => true, “timeFormat”=>”HH:mm”));

The result shows as “false” in the grid and it should show as a time as HH:mm

1 Answers
Abu Ghufran Staff answered 2 years ago

Hi,

Currently, the internal code does not support date with mili-seconds format.

You can try removing (the bold text) the ‘2021-01-05 14:40:00.000000‘ from date using filter loop and in source format setting of date column, removing the “.v” in “srcformat”=>’Y-m-d H:i:s.v’.

Hopefully this should work.

PS: Sorry for the delay.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

14 + 10 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?