Daylight Saving Cause an issue on jQuery UI datepicker on Firefox - javascript

I'm having an issue with jQuery UI datepicker on Firefox.
I am working on a system based on schedules for a future date and I noticed that 2016-03-31 is Thursday, which is correct, but 2016-04-01 is also Thursday when it should be Friday!
The issue appeared on both the desktop and mobile version of Firefox, but not on other browsers.
The interesting thing is, it happens in the demos on https://jqueryui.com/datepicker/ too!
Screenshot on https://jqueryui.com/datepicker/ for March 2016:
Screenshot on https://jqueryui.com/datepicker/ for April 2016:
As you can see, all dates on April have the wrong day of week. It is shifted by one day.
Screenshot on https://jqueryui.com/datepicker/#multiple-calendars for March to May 2016:
As you can see, it's wrong in April but correct in March and May.
And, in response to a comment below, yes, I'm in Jordan, Asia. So?

The issue is related to my country because:
Per #Pang comments,
Jordan is having some Daylight Saving Time changes on 2016-04-01 and the change is right at 00:00:00! Apparently, Jordan does not have 00:00:00 on 2016-04-01 so Firefox is confused and thinks that 00:00:00 is still Thursday.
And the problem is fixed on the 1st of April automatically :)

Related

Full calendar show only chosen date

I want to know if its possible in FullCalendar to show only two chosen dates in week-view for example
1 Jan 2017 | 2 March 2017
not 1,2,3,4,5,6,7 Jan 2017
I made research how to move an event from one date to another for example from 1 Jan to 2 March, but didn;t found solution about that, I think only way to handle this kind of situation to move events between dates is to show just two dates like I explained in question

Material-ui: Make Datepicker inclusive

I am using Material-ui Datepicker to allow users to download timed event information from a database ie. all the events between two given dates. However, at the moment if two bracketing dates are chosen no events for the end date will show up. For example: choosing bracketing dates of 4 April and 6 April results in a download of all events from 4 April #00:00 to 6 April #00:00 instead of 6 April #23:59. Right now, people wanting events from 4 April to 6 April have to choose dates 4 April and 7 April. Is there a way to make the behaviour align with expectations?
No, there is no way to do that from the component, and there is no reason also. This behaviour should be handled on the application, so don't worry, you are doing it in the right way :)

D3.js time scale quirk with "11 PM" values

While using d3.time.scale() I am seeing some funny behaviour regarding the formatting of the tick marks.
When zooming in from months to days, sometimes I get the date format in the axis to be %H %p (which renders "11 PM" for example, not showing the day.) This renders like so:
Wed 11 | Fri 13 | 11 PM | 11 PM | 11 PM ...
The dataset I am using has day granularity, and no time information. I would have hoped for %a %d (which would render Sat 15). Actually, some of the tick marks do show the correct formatting, while others do not.
Is there a way to avoid this quirk?
I was able to see this quirk in, at least, these two Mike Bostock's blocks: Zoomable Area, or Focus+Context via Brushing.
I've seen in thread "d3js: time scaling and “1901”" that a tickFormat property can be added to the axis, thus overriding the normal formatting. The issue here is that I want to keep the scaling formats (from years to days). I am not sure how to pass tickFormat a list of formats, or even only override the formatting in some situations.
The problem occurs because the timezone the dates are parsed with and the timezone set in the browser are different. See this page for an explanation of the issue and solutions.
As #Lars Kotthoff pointed out, it is a timezone issue. The data I am using has no timezone information nor time information (e.g. "15-Aug-2000"), and the errors appear during the change date for DST periods.
To correct this issue, in my case, I changed the x-scale from:
d3.time.scale(), to
d3.time.scale.utc().
This change (as suggested in the link provided in Lars' comment) seems to have solved the issue.

Why is Safari confused about Date.getDay() for DST start in Sydney, Aus time zone?

Safari on OSX believes that October 6th, 2013 is a Saturday in Australia. It's not, it's actually a Sunday.
To replicate this issue, just set your time zone to Sydney-Australia, pop open the dev console in Safari, and enter new Date("2013/10/06"). You'll get this:
Now change to Seattle-US and you'll get this:
The problem also occurs for Melbourne-Australia but not for cities further north such as Brisbane (which fits the zoning for Australian DST), or a handful of other cities I've tested throughout the world.
Now, it just so happens that October 6th, 2013 is the start of daylight savings time in Sydney.. And the same mistake is made for the other DST start dates in other years. There does not seem to be a problem for DST end dates. There does not seem to be a problem for DST start dates in PDT time zone. Also, Chrome and Firefox do not exhibit this problem.
I've tested most of this on two different Macs, one on Snow Leopard with Safari 5.1.7 and one on Lion with Safari 6.0.2.
So the question is -- is this a bug or is there some kind of rational reason for this?
This really should be considered a bug - Technically speaking DST in Sydney starts on 2013/10/06 at 2AM, so 2AM then becomes 3AM (http://www.timeanddate.com/worldclock/clockchange.html?n=240). It appears Safari in this case is thinking you mean 2013/10/06 at midnight - and is then going back 1 hour to 11PM the previous day. This doesn't even make sense because at 2AM the clock is supposed to go forward an hour.
I would recommend filing a bug report for this - because the output is so obviously wrong
https://developer.apple.com/bugreporter/

jQuery ui datepicker, select range of whole weeks only

I need to create a jQuery ui datepicker that will let users choose a start week of the year, and an ending week of the year. IE: Always Sunday - Saturday. Is this possible?
DatePicker can restrict a user's selection, but only as far as restricting the user between two dates (minDate and maxDate options). As far as I'm aware, there's no built in functionality that can restrict selection to only Sundays or Saturdays.
DatePicker does however have a means of calculating the week of a user's selection with the following snippet of code:
$.datepicker.iso8601Week(new Date(dateText))
You can see how this could be utilised in the following jsFiddle (read below, first).
The only problem with this is that the ISO-week always starts with a Monday. So even though in the demo above I have set Sunday to be the first day of the week, if you try selecting the date Wed 7th March 2012 you'll see in the datapicker it shows as week 9, where the ISO-week will return 10. I left it in on purpose to show you this pitfall.
Although this doesn't provide a direct solution to your problem, hopefully it'll help in determining if you should use DatePicker at all to produce your desired functionality.
edit
Actually, just found this question which might be of use to you, looks like it's possible : Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?

Categories

Resources