Passing a previous date in link - ruby-on-rails-3

I want to create a link name as Previous date and Next date in my show action. Please suggest me that how should I pass the date in that . i.e. If one clicks on the previous link then the records are displayed of the previous day and vice versa.
How to pass the date in show action? Please guide.
P.S. :- I am using rails 3

To display date and pass as link parameter you can use either ruby code or jQuery .
Ruby : To get the date :
How to calculate next, previous business day in Rails?
Put such function in your application helper . And call into you view and also pass as link parameter .
jQuery :
Error creating a '< previous' and 'next >' (date) link for jQueryUI datepicker using setdate

Related

Tableau : Click in the field of bar-graph changing Date parameter

I have a pretty simple use case.
I have the Bar-Graph where one of the X-axis is Date Field grouped together on data to form the image attached below .
So , I want that whenever , I change click on any of the Stick of bargraph , then the StartDate and EndDate on the top filter gets changed .
Eg :
I click on December 25,2022 then automatically it becomes StartDate: 25Dec2022 and EndDate: 25Dec2022.
I created the parameter, calculative fields and Actions->Change params but something is being missed out or I am out of track.

Selenium Google Trends Custom period

I am trying to get daily data from Google trends using Selenium.
Therefore, I need to Input the start and end date in both boxes. For the start date, I use the following which works fine:
elem4 = browser.find_element_by_class_name("md-datepicker-input")
elem4.clear()
elem4.send_keys("01/01/2018")
However, the second box has the same class name 'md-datepicker-input'.
Picking it via xpath also doesnt work...
Has anyone an idea how to select that box, clear it and input my data?
Example custom period
Here is the CSS that you should use for To date.
.custom-date-picker-dialog-range-to .md-datepicker-inpt
If you want to use xpath
//div[#class='custom-date-picker-dialog-range-to']//input[#class='md-datepicker-input']

How to insert validation in datepicker interactive report in apex5.0

I have one field :P2_DATE, datepicker on an interactive report in apex5.0.
First Question:
How can i create validation thru:
1. A dynamic action
2. A validation process
that gives an error msg: 'Date should not be greater than system date'
when user choose from datepicker.
Second Question:
How to show only today's date in the date picker and disable others dates.
Pls provide steps-by-steps instruction if possible...thxs!!
Add Validation
Set type to PL/SQL Expression and put:
to_date(:P2_DATE,'DD-MM-YYYY') = to_date(sysdate,'DD-MM-YYYY')
You can see this Answer:jQuery Date Picker - disable past dates for disable dates in datepicker but you already have control over date by validation.
Another way is to create custom datepicker from external plugin.

Bootstrap DatePicker setDate method not updating calendar

I'm setting the value of a bootstrap datepicker by making use of the setValue method provided.
For example
tripToDatePicker.setValue(tripFromDatePicker.date);
But for some reason the calendar is not updated
'setValue' is replaced by 'setDate'.
Using a string as input for setDate can be tricky. It has to match with the dateformat, else you can get unexpected results. It is more safe to create a 'new Date(y,m,d)' from your input, e.g. new Date(2015,3,10) for '10 Apr 2015'. This will always work.
When using a date representation in seconds, e.g. 1428659901, then use 'new Date(value*1000)'. Note that datepicker will eat any value here, but only show the selected date in the calendar if hours, minutes and seconds are equal to 0. Took me a while to figure that out....
Edit:
http://www.eyecon.ro/bootstrap-datepicker/ is not much documented, you should try http://eternicode.github.io/bootstrap-datepicker/.
anyway the code below will work for you
$("#dp1").datepicker("update", "02-16-2012");
or
$("#dp1").datepicker("setValue", "02-17-2012");
where "#dpi" is the id of the text field on whcih datepicker is used.
After trying many things, I ended up using "update" method. The $("#dp1").datepicker("update", "02-02-2012") or $("#dp1").datepicker("update", "02/02/2012") works for me. Surprisingly no document about this method at author website. Thanks.

Bootstrap 3 - DateTimePicker - Can time portion be ignored?

I'm using the Bootstrap 3 DateTimePicker. When the user tabs into a field using this component, the current date and time is automatically entered. In some cases this is what I want. However, there are other times I want the component to completely ignore the time portion and not entered by default in a field. I can't seem to find a way to do this.
This will only display the date by default, try and see
$('.future');.datetimepicker({
pickTime: false,
format: 'DD/MM/YYYY'
});