27
loading...
This website collects cookies to deliver better user experience
calendarModule.CalendarEvent
and that's all I know. I simply create an event and see that there is a startDate / endDate / title / color. Outside of that I am not sure I can do much else
2021-07-04
Sun Jul 04 2021 00:00:00 GMT-0400 (EDT)
As you can see here I can some extremely different data. But in the end I can normalize them both using Carbon. I won't go super in depth or any in depth by that means about it, but the FullCalendar is built inside a monolith from hell that uses the TALL stack and the mobile APP strictly gets data, so both calendars are getting data from separate routes. Both calendars however get Laravel JSON resources returned, both a tad different since FullCalendar has more options for events.
00:00:00
timestamp and it bit me in the ass. I'm honestly not sure how I got this far with this particular items slipping through the cracks. I think it's cause on FullCalendar I was using all day events and didn't come across it until the mobile calendar converted timezones under the hood. I did however come up with a nice little bit of code that will properly convert all timestamps from one specific table to the timezone of the charter then to UTC then save, if in fact it was not already in proper form. Yea that sounds like a mouthful and sounds like a bit of a JR move but hey I screwed it up to begin with and came up with a reasonable solution. Some times as developers we just have to realize we've messed up, come up with a solution, and move on. I ran a bunch of local tests just to make sure this would not have any undesirable side effects and I feel 97% sure about it, and where I come from C's get degrees and I'm well above that shit so BAM!!!!!!!!Y-m-d H:i:s
Carbon::parse($date)->setTime(0,0)->format('Y-m-d H:i:s)
$charter->time_zone
. I find the charter first
->tz('UTC')
. Thank you Carbon for making that easy. You could also use the method ->setTimezone('UTC')
which does the exact same thing, and I think you can also do ->setTimeZone('UTC')
. So in my opinion this is why Carbon is the best. It seems to be the universal standard in laravel, where as in JS, people use Date, date.js, moment.js, and so on. I wish there was more of a "standard" but honestly use whatever works for you and call it a day. Range
it's going to have (for dates) a start and an end. Also items that are used with both are Id (for obvious reasons) and title (which is just a string stating the events name). If you haven't used JSON resources from Laravel well they return an array of "data". Since everything is stored as UTC timezone, the only thing I need to do is convert that back to the local time zone of the charter and I can do this by:'start' => $this->start->setTimezone($this->charter->time_zone),
'end' => $this->end->setTimezone($this->charter->time_zone),
00:00:00
timestamp it always showed up a day before because it was converted to the local time zone of the phone (emulator). Well when I send it back to the local timezone of the charter (presumably the phone as well), it showed up correct. So this may 100% come back to bite me in the future and I made a Trello ticket to keep it in the back of my mind but for now it works and I can move on to the next story. forgot password?
and is a clickable link. That being said I'm 90% sure that when a captain downloads this app, they will never update it whatsoever, if they even download it. That means once this goes live that's it and little things like this really make me nervous as if something as simple as a timezone messes up their calendar but they cannot figure out how to reset a password, will they update the app, or even use it for that matter. But alas as a single programmer that is not my concern. I just cash a paycheck and slap the keyboard. Until next week..........