duration and repeat - javascript

I'm trying to put the logic together for this and it seems like I cant get no where. I have my repeat all set depending on week(s). But what about duration? Let's say someone is schedule for 2 days (duration) for every week (repeat). How would I put this together depending on two given dates?
http://jsbin.com/usori3/15/edit

Hopefully this page will have all the answers Javascript date object. You can add days to a date to get a new date (2 days for your schedule) then add another 5 days (to complete the week) to start the repeat. Compare that date to your end date to see if you've finished. As Daniels says in the comments, it would be good if you could be a little more specific, but I hope that answers your question or at least points you in the right direction. It may even be worth looking at JQUERY to see if there's a plug in for the date handling that may help you further.

Related

Find the point where maximum intervals overlap for certain interval length

I'm trying to maximize attendance to a event given a list of busy times for each person. The event can be scheduled anytime between a certain date and hours (Ex. March 1st to March 8th from 9-5) and that attendance is maximized.
So far I've tried using a sliding window approach, and a counting approach described here (https://www.geeksforgeeks.org/find-the-point-where-maximum-intervals-overlap/) however I only managed to get the sliding window approach working with a time complexity of O(n^3) which unfortunately is not good enough for my use case. The counting approach does not work because I can find the maximum interval but not for a certain timeframe.
A worst case scenario use case would be ~500 people and a month timespan.
Any help would be much appreciated.
Solved using a Interval Tree (https://en.wikipedia.org/wiki/Interval_tree)

How to occupy all the days in fullCalendar?

A query for those who have used fullCalendar. I use version 3 of fullCalendar.
I have the dates (the step without hour:minute) start 2020-06-01 end 2020-06-03
But I'm only occupying 2 days as seen in the picture, instead of 3 days [1,3]. I don't know why this happens.
I understand that by default you may be taking the time as 00:00 and this is giving "that problem".
The question would then be, if you need a configuration that takes the full day on the last day, and I don't know if such a configuration will exist?
This is covered in the documentation. End dates are exclusive - see https://fullcalendar.io/docs/v3/event-object .
This means your event is actually considered to end at 2020-06-02 23:59:59. Therefore it doesn't actually occur on 2020-06-03 and so is not shown on that date.
The workaround, if you wish to show it on that day, is to add one day to your end date.

Change the real time into a given span of time, with jquery, mysql and/or php

I'm working on an RPG chat coded in old php-mysql and javascript (at the time there was no jquery), and the playing story is about vampires (not a twilight style, I assure you :P).
And I need to set a time watch visible, that doesn't have the real time, but only a night time, extended throughout all day.
For example, at real time 6 AM, must correspond a in-game time of 20PM, and so on, until a real time 5:59AM, which must correspond to a in-game time of 5AM.
So that through the whole real-life day, the in game time span goes only from 20PM to 5AM, only the night, in short.
Is it possible? It's ok to use php and mysql, or even jquery or javascript (even though I think it would be easier done with the last two).
PHP writing is in the old procedural style, not object oriented, just to specify.
Thanks for the replies!
Interesting problem. I would think the algorithm would go something like this:
Calculate what percentage of an actual day has passed.
Use that to calculate how much time has passed in a virtual day (multiply times 32400 to get the number of seconds, probably).
Add that number of seconds to a date object that has been set to 20:00PM on today's date.

How to add a number to a table cell after a certain time

I'm very very new at programming, so please be gentle. I've been working with Dreamweaver for only a few days and I'm having trouble with adding 2 to a number in a cell, when the clock shows XX:00:00 or XX:30:00. In other words, I want the number 2 added to the content of the cell every half hour.
If I understand your question right, you would like to add 2 to some value every half hour?
You have tagged your post as both Java and Javascript, those are two different languages, so please correct. Since you have worked in Dreamviewer I assume you are developing web pages and the language you want to use is Javascript.
Setting a timer in Javascript:
setInterval(function(){myFunc()},1800000); //1800000 = 30 minutes in milliseconds
function myFunc()
{
//Code to update the cell
}
If you actually meant Java, the question is answered here: How to set a timer in java.

workflow / option to expand other options?

I have a question about a conference quotation form that I am building.
Once the user enters various information such as the conference date, number of delegates etc, I need other options to appear dependant on the duration of the conference. ie. If the user inputs dates showing that the conference will last 3 days - then 3 "sections" needs to appear for each day of the conference with inputs regarding meals for that particular day, etc.
What route could I take to accomplish this?
I am struggling to explain - so If i am not clear, please tell me and I will try to explain better
thank you
I'm sure you'll find something here: jquery datepicker difference
If you have the difference in days you can simply add a for loop
for(var i=0;i<differenceInDays;i++){
$('#days').append('<input name="day'+i+'"/>');
}

Categories

Resources