Determine Whether Two Time Ranges Overlap?

Oct 7, 2011

When it occurred to me that I needed to calculate this, I knew it was over my head. (although I did come up with what I thought to be a pretty clever solution involving a very complex series of arrays...) So I decided to google it. The trouble is, the solution was a little over my head too... So I hacked away at it for about an hour, and finally it worked, but on closer inspection I had made a typo from the original algorithm.

Is the original algorithm correct, or flawed? is my interpretation correct/flawed, or the same? I'm not really sure what I did here, but after many tests, I think I got the correct solution.

original post on [URL] Let CondA Mean DateRange A Completely After DateRange B (True if StartA > EndB) Let CondB Mean DateRange A Completely Before DateRange B (True if EndA < StartB)

Then Overlap exists if Neither A Nor B is true ( If one range is neither completely after the other, nor completely before the other, then they must overlap)

Now deMorgan's law, I think it is, says that

Not (A Or B) <=> Not A And Not B

Which means (StartA <= EndB) And (EndA >= StartB)

NOTE: This includes conditions where the edges overlap exactly. If you wish to exclude that, change the >= operators to >, and <= to <

And finally the test scenario that I finally got to work:

<input onclick="this.value=''" onkeyup="TEST()" id=inhour1 value=1>
<input onclick="this.value=''" onkeyup="TEST()" id=inminute1 value=1>
<br />
<input onclick="this.value=''" onkeyup="TEST()" id=outhour1 value=2>

[Code]....

View 13 Replies


ADVERTISEMENT

Calculate Date Ranges Using Script?

Sep 12, 2011

I'm fairly new to programming in Javascript and quite frankly find it difficult (an old COBOL programmer). My question is this, are their any functions in Javascript that are similar to the VB.Net "DateDiff" function? If not, are their any free code snippets that will calculate the range of days and/or months between 2 date values?

View 1 Replies View Related

JQuery :: Calculate Number Of Months Between Date Ranges?

Aug 3, 2010

For a project that would be too hard to explain, I am working with date ranges. There is a begin date and an end date. With those two variables, I need a function to calculate the number of months between both dates. To be more precise, I need a count of all unique month names in the dates (or month numbers if that is easier) where the range includes the beginning date, the end date, and all dates in between. So I am not looking for full months or an approximation. If only, say, one day of a given month is included in the date range, that adds a month. Also the range can span several years, january 2010 and january 2011 need to count for two different months.

View 2 Replies View Related

Slider With Multiple Handles To Create Multiple Ranges?

Jul 20, 2010

Does anyone know of a Javascript slider that can function like Adobe's gradient creator?I'm not actually making gradients, I just need similar slider capabilities.I have a defined date range, let's say it's January 1 to Januaray 31. I want to make a slider that allows my user to split this date range into multiple ranges. So one person can do:

Jan 1 to Jan 5, Jan 6 to Jan 12, Jan 13 to Jan 31 Another person can do: Jan 1 to Jan 21, Jan 22 to Jan 31. How many regions they create doesn't matter to me. The goal is to pull it off with a Javascript slider that works similar to Adobe's gradient creator. Handle's can be added by clicking and removed by pulling it away from the slider. Handle's can also slide around fairly liberally.

View 1 Replies View Related

SVG And Dragging Div Overlap Conflict?

Jan 25, 2007

I have an SVG file and draggable div on one page. When I move div over
this SVG file, it looks like div loses control and detaches from the
mouse. If I do it slowly, div seems to barely follow the mouse which is
being over SVG.

I tried assigning zIndex to SVG file to be the same as other elements
on the page, but that did not help. Would anyone know why this happens?

View 4 Replies View Related

Overlap Images In A Carousel?

Dec 15, 2009

I'm working on modifying a jQuery plugin that makes an image carousel. I like how it is not with one exception... I'd like the images to overlap one another. So the main image that is displayed will overlap the ones on either side of it somewhat.

You can view the source of the demo I posted to look at the JS for it... I used the "moving boxes" plugin and already modified it a lot.

how to overlap images using CSS?

View 1 Replies View Related

Overlap Applet With Other Html Element

Jul 23, 2005

Is there any way to make a <div> section
overlap the (windowed) content of a java Applet?

I'm asking this, because JavaScript menus usually
ends up beneath Applet windows..

View 4 Replies View Related

Absolute Layers Stop Overlap

Mar 6, 2006

i have been looking for a script like this for a few weeks now, and i
am finally giving up and asking for help. everything i found involved
preventing overlap in dreamweaver, i want to prevent it in the output
on all of the browsers.

basically i have a page that has absolute layers (cannot be relative)
with the coordinates top/left in the db. but sometimes on certain
pages the layers overlap. I cannot set a static size for those layers.
so i was wondering if anyone has a script, that will check for any
overlapping of layers, and if it overlaps, to move the layer to the
right, or down, until it no-longer overlaps. i can modify anything
similar if you have it.

View 6 Replies View Related

JQuery :: Accordion Overlap & Not Slide

Oct 9, 2009

Does anyone know if it is possible to have an accordion menu not slide items down, but instead have that list item expand over the elements below it?

View 1 Replies View Related

JQuery :: Image Overlap In Slider?

Feb 12, 2010

I've built this slider, but I can't get it to line up. The link is [URL]...

View 2 Replies View Related

Overlap Image Viewer Timing?

Feb 12, 2009

I am using the Overlap Image Viewer in which case has worked out perfectly except for one small thing, it pops up very quickly.

View 6 Replies View Related

JQuery :: Scrolling DIV Overlap Footer On Page

Sep 23, 2011

I'm using this small js to scroll a div, the problem is that it goes all the way to the bottom of the page and overlapping my footer, I need it to stop before the footer. [URL]
$(function () {
var msie6 = $.browser == 'msie' && $.browser.version > 7;
if (!msie6) {
var top = $('#contact').offset().top - parseFloat($('#contact').css('margin-top').replace(/auto/, 0));
$(window).scroll(function (event) {
// what the y position of the scroll is
var y = $(this).scrollTop();
// whether that's below the form
if (y >= top) {
// if so, ad the fixed class
$('#contact').addClass('fixed');
} else {
// otherwise remove it
$('#contact').removeClass('fixed');
}});
}});

View 2 Replies View Related

JQuery :: Order Absolutely Positioned <div> Tags Without Overlap?

Aug 26, 2009

I have about 40 divs, all positioned absolutely with a certain width and a left attribute.I am looking for a way to make sure all these divs don't overlap, meaning that if one div has its starting point (left) within another div(left+width), the first div should be moved down as long as it takes (height of 2nd div).Having barely any experience with jQuery at all, I really hope I can find some answers here.

View 2 Replies View Related

JQuery :: Overlap Of Drop Down Menu And Accordion Block

Apr 14, 2011

i renamed this topic, original post was sent yesterday under "override of drop down menu and accordion (display problem)" and published in Using Jquery UI)I set a drop down menu using jquery naviDropDown 1.0 and use accordion of jquery-ui-1.8.11 too. I have a problem because the drop down menu is diplayed behing the accordion block.

View 2 Replies View Related

JQuery :: Modifying Splatter Plugin To Avoid Collision/overlap

May 25, 2011

jQuery Splatter by Cory Schires

I was looking for something that would allow me to scatter elements (divs w/ background-images) behind text. Splatter is almost what I want, but I would need:

- no overlap in the positioning of elements

- keep the elements inside the container

- remove the default asterisk completely

As I have varying article dimensions, this keeps the splatter area the right size:

Code:

height: $("#article-text").height(),
width: $("#article-text").width()

Could the collision detection code in jQuery UI Position be used somehow?

View 1 Replies View Related

JQuery :: Modifying Splatter Plugin To Avoid Collision/overlap?

May 25, 2011

I was looking for something that would allow me to scatter elements (divs w/ background-images) behind text. Splatter is almost what I want, but I would need:

- no overlap in the positioning of elements
- keep the elements inside the container
- remove the default asterisk completely

As I have varying article dimensions, this keeps the splatter area the right size:

Code:
height: $("#article-text").height(),
width: $("#article-text").width()

Could the collision detection code in jQuery UI Position be used somehow?

View 1 Replies View Related

JQuery :: Tablesorter Plugin - Up/down Arrow Icons Will Overlap With The Text In A Column's Header

Nov 23, 2010

I am using the tablesorter plugin and am experiencing the following problem:

Under several scenarios the up/down arrow icons will overlap with the text in a column's header. This occurs if the browser is resized so the table width is too narrow (e.g. plugin should force a min-width perhaps?).

More importantly, this will also occur when the text in a columns header is shorter than any of the values in the column the up/down icons overlap with the text in the column header.

I've attempted setting padding on the header columns but no success (probably because the up/down icons are set as background images and therefore have no impact on padding)

At the moment the plugin won't be usable for me since the arrorws overlap with the text in several columns.

View 1 Replies View Related

Could Hardly Read Its Text Because Its Overlap Content Text And Pictures?

Oct 10, 2011

I have a bar which dropdownbox so transparant, in a way that I could hardly read its text because its overlap my content text and pictures.

But its order superseed the side bar box. I could clearly read its text on the side but hardly read its text on the middle. I am using jquery which I copy from a tutorial video.

What might be the problem? I would like the text could be clearly read in the navigation bar in order word it suppose to be above the content text when I open the navigation drop down box.

[Code]...

View 1 Replies View Related

JQuery :: Making One Element Overlap Another Element?

May 30, 2009

is it possible to programmatically make one div element overlap another div element. right now, i am stuck with having two elements on my page which overlap and one of those elements is "behind" the other when i want it the other way around.

View 1 Replies View Related

Script With Document.write Inside Iframe Hangs First Time, Works Second Time (in IE)?

Dec 22, 2010

I have put together a script which does this:

1. Make ajax request (via getHTTPObject(), no libraries is used)

2. Create an iframe with script, src is "blank.html".

3. use iframe.document.write() to execute scripts (inkluding document.write based scripts) in the iframe.

4. call parent window's document to clone the iframe content.

5. Append the content clone to parent body.

Works like a charm in all browsers but IE, where every version - including IE9 beta - hangs on iframeWindow.document.close() with empty cache, leaving the window/tab unresponsible. When I force quit, restart and load the page again (now in cache) it works.What I've tried already:

* Googled.

* called the ajax request callback manually with string instead of request.responseText - it works even with empty cache here.Removed document.close() - resulting in scripts in iframe not executing at all (again, only with empty cache, cached pages works fine).

* Tested to make the ajax request synchronous - no difference.

Console.log trace:

Code:
append() begin
unlimited-scroll.js:160 install() begin
unlimited-scroll.js:194 iframe begin[code].....

View 2 Replies View Related

Automating Text To Change Daily At Specific Time To Website Viewers Time?

Sep 17, 2011

I do pretty much all the computer related tasks, which includes computer system repair, audio/video editing, cd/dvd printing and duplication, document format and creation, etc etc. But when it comes to HTML (or other codes) I know very little. But we needed a website, so I use Homestead hosting and the Homestead (offline) Site Builder program.

Anyway, inside the sight builder program, they have the option to insert HTML Snippets. Which I use for various objects, off site tools, and other. But now I need to do something for which I have not been able to find a "premade" html code object, that can perform the task desired. I have searched and searched google and went through many sites, including this one. I have tried to take some codes which I thought I could alter to make it perform, but they just wouldn't work for what I needed them to do.

I need a code that will automate a "specific text message" to change daily, and to schedule a "different specific text message" to appear each day. I need to be able to schedule each days "texts" at the very least 31 days in advance. In other words, I need to make an array (I think that's what it is called) for the entire month:

Day 1 "today's text 1"
Day 2 "today's text 2"
Day 3 "today's text 3"

[code]....

If were possible to make an "array" that would go six months out (or more) that would be very helpful! But the longest that I have seen is one month at a time, so that may be as long as they go, but I'm not sure.On top of all of this, I need these changes to be performed at a specific time of the day. I would like them to be preformed at sunset everyday, but I don't think there is anyway to direct the code to look at like [URL] sunset times or such. So if I can at least choose a specific hour, like 8:00 pm, that will work, I will just have to adjust this every once in a while.

However, I don't want it to change just at 8:00pm in my timezone. I need it to change at 8:00pm according to the website viewers timezone. Is there a way to make the code "look" at the users computer and "get their time" and use that to adjust what text is displayed? In other words, I live in Indiana USA. If someone in Australia looked up the webpage on the 15th day of the month, but it was 9:00pm Their Time. The text I need to be displayed should be for "Day 16" from the array.

View 13 Replies View Related

Populate Select Boxes - Create Events, With A Start Time And An End Time?

Jun 3, 2009

I'd like some direction on creating a small piece of Javascript that will populate my <select> boxes.Basically, I have a form for users to create events, with a start time and an end time. (These are the two select boxes).For example:

Code:
<select id="startTime">
<option value="12:00AM">12:00AM</option>
<option value="12:15AM">12:15AM</option>
etc.....
</select>

What I am trying to do is:

1) Have times populated in 15 minute incrementals from 12:00AM to 11:45PM

2) Have some type of "error checking" available to where the End Time must be after the start time. It would be nice for the script to automatically change the end time field to a time that is after the start time.

View 11 Replies View Related

JQuery :: Application With PHP - Ajax Doesn't Work Time To Time ?

Apr 21, 2011

I'm writing an application with PHP that let me have statitics about visited pages for my web site. to save informations needed i use an ajax query with the unload event. The problem that i have is titme to time the script uses with that ajax query doesn't work especially when i stay long time in a page.

This is my code?

Why it works most of time but sometime doesn t work? is there any specifications to take for the unload event ?

View 11 Replies View Related

Check The User Enter Time With Current System Time

Mar 2, 2011

I am trying to check the user enter time with current system. If user enter the time less than the current system time then I want to display the alert box. But the code is not working. Here is the code

<html>
<head>
<title>test</title>
<script type="text/javascript">
var d = new Date();
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
[Code].....

View 11 Replies View Related

Real-time Countdown (count From Start To End Time)

May 30, 2011

I do have the countdown script (see link below) to display the time between current time and the date given in real-time. However, I want to achieve to display the time difference between a given start and end time. Right now, it calculates from the current server time to the end time. I want to be able to set up my own start time and end time.

View 2 Replies View Related

Live Clock With Date, Time, And Time Zone?

Jun 7, 2009

I have scoured the net and found nearly what I'm looking for, but not exactly, and I don't really know javascript, so trying to piece together bits of code hasn't worked. What I need is the script for a live clock with date and time format exactly as follows: Sunday, 07 June 2009, 24:00:00 (GMT+1).I have two separate files with the following code, which gets me close to what I need: Sun Jun 07 19:05:48 2009 Obviously the time is in the wrong place and it doesn't show GMT+1. These are the scripts:

Code:
function update() {
time = Date();[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved