@shotbyabel wrote:
We managed to display dates in our app the way the clients wanted them. It was a difficult task for us but we were happy with the result. We are using Ionic Framework and the following ERRORS are appearing ONLY on the iOS devices and Emulators. Browser and Android display the dates perfectly.
SO I've been reading from here that some people had luck with the .split method. We added that to our code but continue getting this error and what displays is broken ng-bind {{}}.. This is the error from iOS
E R R O R: convDate.split is not a function. (In 'convDate.split(' ')', 'convDate.split' is undefined)
**Error: convDate.split is not a function. (In 'convDate.split(' ')', 'convDate.split' is undefined)** file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/js/controllers/BookingsController.js:147:35 fn regularInterceptedExpression@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:23059:37 expressionInputWatch@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:22961:42 $digest@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:24507:43 $apply@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:24783:31 done@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:19196:53 completeRequest@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:19368:15 requestLoaded@file:///var/mobile/Containers/Bundle/Application/104DE270-18AC-4FB1-9F97-66F93E885A0B/driverApp.app/www/lib/ionic/js/ionic.bundle.js:19309:24 (anonymous function)console-via-logger.js:172 (anonymous function)ionic.bundle.js:21161 (anonymous function)ionic.bundle.js:17940 $digestionic.bundle.js:24532 $applyionic.bundle.js:24782 doneionic.bundle.js:19195 completeRequestionic.bundle.js:19367 requestLoadedionic.bundle.js:19308
OUR DATE FILTER CODE
.filter('customDateFilter', function($filter) { return function(input) { var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'Novemeber', 'December']; var weekdays = ['SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY']; var convDate = $filter('date')(new Date(input), 'MMMM dd EEEE yyyy'); var inputDate = convDate.split(' '); // SHOW "Today" on today's date instead of actual date O_o var showToday = new Date(); if (inputDate === showToday) return "TODAY"; if (inputDate !== showToday) { return inputDate[2] + " " + inputDate[0] + " " + inputDate[1]; } }; })
the code in the view for the customeDate fiter..
<span id="dates-fonts-styles">{{groupedBooking[0].driver_departing_time | customDateFilter}}</span>
function that groups our bookings.. (not sure if is necessary)
function setBookingGroupDate(bookings) { //*2*Go through each booking for (var i = bookings.length - 1; i >= 0; i--) { var date = new Date(bookings[i].driver_departing_time); //*3*Create date from drvier_departing_date var dateWithoutHour = new Date(date.getFullYear(), date.getMonth(), date.getDate()); //*4* create same date but w/o the hr to minimize the differences var dateCode = dateWithoutHour.getTime(); //Get timeStamps to have same filed for all and same type to be able to order and GROUP bookings[i].groupByDateCode = dateCode; //add it back to respective booking[index] }; //Return the bookings return bookings; }
The dates that are returned from this code are Monday January 18 and so on..
ONLY iOS is shooting us the error and displaying the {{groupedBooking[0].driver_departing_time | customDateFilter}} as is on the view..Does anyone know if there's a work around for this? We tried .split based on lots of good resents from here.
Posts: 1
Participants: 1