Remove minDate/maxDate limits in jQuery UI Datepicker - jquery-ui-datepicker

A simple issue, but I can't seem to find the answer.
I've limited the date range in jQuery Datepicker:
$( "#MyDatepicker" ).datepicker( "option", "minDate", new Date())
Is there a way to remove all restrictions for date range?

Try this $( "#MyDatepicker" ).datepicker( "option", "minDate", null).
From JQuery documentation about datepicker minDate option
Set a minimum selectable date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '-1y -1m'), or null for no limit.

Using this jQuery datepick, what about
$(selector).datepick();

Related

Swift 3 FSCalendar select all dates by default

I am able to select certain dates while loading the FSCalendar. But I want to load calendar with all dates selected.
var attendance_list = [NSManagedObject]();
//After loading data
for attendanceObj in attendance_list{
let createdDate = attendanceObj.value(forKey: "date") as! String;
self.calendar.select(Utils.convertStringToDate(createdDate))
}
Above code is for selecting dates from an array.
How can I select all dates without any array ?
I wouldn't recommend selecting all dates since the beginning of time to the end of the foreseeable future (also, you cannot do it without an array). What I would recommend is getting the beginingOfMonth and endOfMonth (both methods are available) in currentPageDidChange (another available method). Then set the dates between these two dates to selected inside a loop.

JSRender- How to display calendar icon and make date picker field read only

I am using the following code for datepicke in my template.
{^{datepicker fromValue readonly="true" class="myclass"/}}
{^{datepicker toValue ^_minDate=fromValue class="myclass" readonly icon="show"/}}
I tried to achieve following things.
I want to make the datepicker field readonly. For the above code it is not happening.
How to show the calendar icon within the text box. currently its not happening. icon=show...I tried it . I didn't see anywhere.
In my case I have to show the toDate and FromDate at same time. If user first selects the toValue and come back to from value , how to restrict his max date. Currently it is not restricting user.So I can able to select from date which is greater than todate.
Thanks in advance.
For a readonly datepicker, it needs to be on a div, and have _disabled=true. If it is not a div the setting _disabled=true will disable the input, so the datepicker won't show.
{^{datepicker startDate elem="div" _disabled=true/}}
For providing an icon:
{^{datepicker startDate
_showOn= "button"
_buttonImage="https://jqueryui.com/resources/demos/datepicker/images/calendar.gif"
_buttonImageOnly= true
_buttonText= "Select date"
/}}
For start and end date, see http://www.jsviews.com/#samples/tag-controls/datepicker/simple
{^{datepicker startDate
^_maxDate=endDate
/}}
{^{datepicker endDate
^_minDate=startDate
/}}

Mongoose/MongoDB regex find query using variable

I'm trying to perform a find query in mongoDB (using the mongoose framework with nodejs and express) using a regex expression based on a variable. I'm partially able to query correctly using a static string hard-coded into the code but I need to perform the query using a variable who's value is constantly changing.
The query uses three fields (author, date and updated date) and should go through all documents in a scheme and find all documents where 'date' or 'updated date' is like the variable currentDate (always formatted as YYYY-mm-dd) and where author is authorname.
The main issue is that mongoDB stores the dates with ISO format. On execution the string variable (currentDate (YYYY-mm-dd)) is formatted to ISO which leads it to only "hit" documents with time 00:00.000Z as ISO formats 2015-09-17 to be 2015-09-17 00:00:00.000Z (not taking timezone into consideration).
The query:
var currentDate = yyyy-mm-dd;
Scheme.find({$and:[{'local.author': author},
{$or: [{'local.date': new RegExp(currentDate)},
{'local.updated_date':new RegExp(currentDate)}]}]}
I've also tried with the $gte and $lte variables (where $gte = date today and &lte = date tomorrow (00:00)) but I couldn't get it to work, I met the wall trying to perform the regex.
I hope there is a brilliant regex expert out there who can help, thank you! :)
I figured it out without all the complexity.
var tomorrow = new Date();
var today = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(0,0,0,0);
today.setHours(0,0,0,0);
Scheme.find({$and:[{'local.author': author},{$or: [{'local.date': { $gt: today, $lt: tomorrow } },{'local.updated_date':{ $gte: today, $lt: tomorrow }}]}]}

jquery ui multi dates picker: how to disable the sliding effeccT

In the display numberOfMonths: 3, when I click on a date in the second month, it is sliding left. Is there a possiblity to disable this effect?
You would want to use the default functionality for the JQuery UI Date Picker. Link below. Basically take away the animations code.
http://jqueryui.com/datepicker/#default
Delete the code that looks similiar to this:
$( "#anim" ).change(function() {
$( "#datepicker" ).datepicker( "option", "showAnim", $( this ).val() );
});
I have found that on github.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/issues/9, the "slide effect" is enabled, but when you go out of the 3 selected months, it is worse than before: at each date you add, you come back to the 3 selected months.
onSelect:function (dateText, inst) {
var newDate = new Date();
inst.drawMonth = newDate.getMonth();
inst.drawYear = newDate.getFullYear();
inst.currentMonth = newDate.getMonth();
inst.currentYear = newDate.getFullYear();
}
This piece of code put the the top-left month to be always the same on each select (in this case the current month).
So still searching...

Column Chart with date axis not working

I have a Column Chart with an x-axis value which is a date. This chart worked this morning but is suddenly broken and displaying "Bars series with value domain axis is not supported." as an error message. The website in question hasn't been updated in weeks.
My DataTable construction code looks like:
var data= new google.visualization.DataTable({
"cols":[{"label":"Date","type":"date"},{"label":"New Users","type":"number"}],
"rows":[{"c":[{"v":new Date(1325656800000),"f":null},{"v":1355,"f":null}]}]
});
What can I do to my code to fix this?
It's not a bug. Google Visualisation API has changed.
At http://code.google.com/apis/chart/interactive/docs/customizing_axes.html#Help they post some solutions to this problem. Using option:
strictFirstColumnType: false
can only be used as a temporary solution. Google says:
However, please bare in mind that this option is only available for limited time and will be removed in the near future.
The recommended solution is that you change your Date fields on x axis to String. I've achieved this by using formatter before adding value to the DateTable object.
var formatterMoney = new google.visualization.NumberFormat({suffix: ' zł', decimalSymbol: ',', groupingSymbol: ' '});
var formatterDate = new google.visualization.DateFormat({pattern: 'dd.MM.yyyy'});
var data = new google.visualization.DataTable();
data.addColumn('string', 'order date'); //used to be date field here
data.addColumn('number', 'total amount');
data.addRow([formatterDate.formatValue(new Date('2011-12-20')),971793.93]); //used to be Date object, now is Date formated as String
data.addRow([formatterDate.formatValue(new Date('2011-11-30')),1.0]);
data.addRow([formatterDate.formatValue(new Date('2011-11-17')),1.0]);
data.addRow([formatterDate.formatValue(new Date('2011-10-27')),1.72]);
data.addRow([formatterDate.formatValue(new Date('2011-10-26')),10.27]);
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
formatterMoney.format(data, 1);
chart.draw(data, {width: window.width, height: 400, hAxis: {direction: -1}});
The problem is with the Date fields. I've converted the date field to a String and I'm using a String now. In case you are using formatters, you can format the value before supplying it to the DataTable:
formatter.formatValue(date)
I'm guessing this is a bug; I'll try to file a bug report.