Asked
Active
Viewed 1,587 times
-7
-
https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming – Jerodev Nov 19 '18 at 08:44
-
3Please don't post images but add the code directly in the editor and formatting it properly. – common sense Nov 19 '18 at 08:50
-
1@commonsense I got a good laugh from your comment once I saw your username – Polaris Nov 19 '18 at 08:52
1 Answers
0
Unless the code you posted is within a script tag inside a blade file, it is not possible to use Carbon inside of an external JavaScript file.

Polaris
- 1,219
- 8
- 14
-
var time = item.START_TIME; if (time!= null) { start_time = '{{Carbon\Carbon::parse(' +time+ ')->format('g:i A')}}'; }else { start_time = ''; } – user3733987 Nov 19 '18 at 08:59
-
-
-
var time = item.START_TIME; if (time!= null) { start_time = '{{Carbon\Carbon::parse('16:22:42.4245847')->format('g:i A')}}'; }else { start_time = ''; } – user3733987 Nov 19 '18 at 09:05
-
Yeah, I don't think you'll be able to pull in a JavaScript variable inside the blade {{ }} tags. You are better off using JavaScripts Date() object or using moment.js – Polaris Nov 19 '18 at 09:34
-
-
start_time = moment('09:14:53.1497123','HH:mm:ss').format('HH:mm a'); – user3733987 Nov 19 '18 at 09:54
-