Watir,click on a date from a date picker 62 days from current date - date

I need to click on a date that is 62 days later than the current date.
The next button for the months is clickable so I have been able to move the calendar to 2 months later but unable to select the date.
Eg if the current date is 4 July then I need to select 6th Sept.
My code at the moment looks somewhat like this.
b.element(:name, "policyperiod_endDate").click <-- datetime picker's click
b.element(:xpath, "(//button[#type='button'])[50]").click <-- next month
b.element(:xpath, "(//button[#type='button'])[50]").click
b.element(:link,"06").click <--doesnt select 08
b.element(:xpath, "(//button[#type='button'])[68]").click <-selects fixed cell n
how to select 06?
The outer HTML is like this:
input type="text" class="pull-left pdr35 ng-isolate-scope ng-pristine ng- invalid ng-invalid-required" datepicker-popup="yyyy-MM-dd" is-open="datePickerOpts.datepickers.policyperiod_startdate[1]" ng-model="policyIVOs.policyEndDate" name="**policyperiod_endDate**" datepicker-options="dateOptions" show-button-bar="false" close-on-date-selection="true" show-weeks="false" ng-click="open($event, 'policyperiod_startdate', 1)" min-date="policyEndMin" max-date="policyEndMax" required="" readonly=""

Related

Ionic Datetime - use placeholder but also set the date to start

I need to use datetime with a placeholder that says "select your date of birth" when the datepicker is open I need the start date to be 1980, The only way I can do this currently is to set the value of the input to be 1980 but then my placeholder does not display.
Is this possible to achieve with ion-datetime ?
<ion-datetime
displayFormat="DD/MM/YYYY"
placeholder="select your date of birth">
</ion-datetime>
you can display a label at start & then when you click on the label (on focus event or click) you set some attribute to true (you have to set it to false at start) & then when it's true you display the date-time picker instead using *ngIf (also *ngIf for the label).
<ion-item>
<ion-label floating color="secondary">Select Your Date of Birth</ion-label>
<ion-datetime [(ngModel)]="dataofbirthday" displayFormat="DD / MMMM / YYYY" pickerFormat="DD / MMMM / YYYY" monthNames='January,February,March,April,May,June,July,August,September,October,November,December' [min]="mindate" max="2019-12-31" cancelText =Cancel doneText=Select></ion-datetime>
</ion-item>

sqlite3 select condition based on date time('now') bug

I'm new to sqlite. I have a table called "matchs" containing the upcoming games in a club championship. I would like to retrieve the first next upcoming event.
The first column is date_session formatted as "YYYY-MM-DD HH:MM:SS"
So I made query like this:
SELECT * FROM matchs WHERE date_session > datetime('now');
2017_01_09 18:30:00
2017_01_09 19:30:00
2017_01_10 18:20:00
2017_01_10 20:40:00
2017_01_12 18:20:00
2017_01_12 20:40:00
2017_01_16 18:30:00
I don't understand why the rows from January 9th are included in the results. To check that date time('now') is working I just outputted it:
SELECT datetime('now');
2017-01-10 09:30:55
If I do the query on a condition date set by hand, it works fine:
SELECT * FROM matchs WHERE date_session > '2017_01_10 09:30';
2017_01_10 18:20:00
2017_01_10 20:40:00
2017_01_12 18:20:00
2017_01_12 20:40:00
2017_01_16 18:30:00
Of course, as I wish to always have the next upcoming game returned, I can't afford setting this date condition manually.
Can anyone help? I'm using SQLite version 3.15. date_session is stored as TEXT.
- and _ are different characters. In any string comparison, _ > -, so you end up comparing only the year.

Bootstrap 3 DateTimePicker (eonasdan) - How to quickly select year? (for birthdays)

Is it possible in eonasdan's bootstrap 3 datetimepicker to change the dayViewHeaderFormat to show decades or a drop-down menu to choose a year quickly?
Because when someone wants to insert their birthday, it might take a lot of clicks to select the correct year and date. Is there an option to quickly select the correct year? If so, how would this work?
Yes, this is possible using the viewMode function. From the documentation:
viewMode(newViewMode)
Takes a string. Valid values are 'days', 'months', 'years' and 'decades'
For example:
$('#birthday_years').datetimepicker({
format: 'Do of MMMM, YYYY',
defaultDate: new Date(1990, 0, 1, 00, 01),
viewMode: 'years',
});
Here, I've initialised the defaultDate to 1990. You can, of course, change this or use a placeholder to display a text in the input field. Like so: <input ... ... placeholder="Pick your birthday" />.
I've also formatted the date. You can change the date format with these options.
Demonstration of the final result:
> GO TO DEMO

Qlikview Automate past 12 months selection

I have a combo chart which shows the average days it took for a person to pay their bill.
The Dimension of the Chart is = [Pay Month Year last 12 months]
There are no Dimension limits
There is 1 expression which is called Average and its definition is:
avg({< InvoicefromSqlType = {'Invoices'},[Is Invoice Paid] = {'Y'},[Is Positive Amount] = {'Y'},[Is Paid last 12 months] = {'Y'},DueGroups=,[Pay Month Year last 12 months]=>}[Days to Pay])`
Its is sorted by expression, which is [Pay Month Year last 12 months]
Now the above fields are built up like this:
[Pay Month Year last 12 months]
If([Pay Date] >= '$(vPeriodS12)',[Pay Month year]) as [Pay Month Year last 12 months],
PayLoadOrder:
Load * Inline [Pay Month Year last 12 months
May-2014
Jun-2014
Jul-2014
Aug-2014
Sep-2014
Oct-2014
Nov-2014
Dec-2014
Jan-2015
Feb-2015
Mar-2015
Apr-2015
May-2015
];
Now what is happening is every month when it reaches the end, the next month is needing to be manually added and the first month removed (e.g. in the above I would delete the line May-2014 and at the end add the line Jun-2015)
Also if there are months defined which there is no data for yet i.e. you have Jun-2015 hard coded and the current month this May-2015 then Jun-2015 will show data from 2014 and the order of the months will get mixed up.
What I want to do is completely remove the need to hard code the months above and have this done its self.
If there are any more information you need let me know
Instead of using a "sort order" table that you may have to manually update, it may be worth doing the following:
Create a new field derived from [Pay Date] that returns a month and year that you can sort. For example:
dual(date(makedate(year([Pay Date]),num(month([Pay Date]))),'MMM-yyyy'),
year([Pay Date]) * 100 + num(month([Pay Date]))) as PayMonthYear
Here, the dual function allows you to associate a different representation of a field value to its underlying value. For example, here we set the underlying data to be the year of [Pay Date] added to the month, but state that it should be displayed as MMM-yyyy. For example, internally, QV still sees the value 201502, but displays it as Feb-2015. This means you can sort it correctly based on its underlying value.
Using dual is a big topic, please consult the built-in help for QV for more information.
Change your chart dimension from [Pay Month Year last 12 months] to use PayMonthYear and set the sort to ascending. This would then mean that your months would be sorted correctly, even if a new month was added.
Remove table PayLoadOrder from your script.
Alternative Method
An alternative would be to use a calendar table which joins on your Pay Date field. This would achieve the same thing, however, you could also integrate your "year to date" indicator into the calendar as well and remove it from your main table. An example I quickly threw together is shown below:
MinMax:
LOAD
Max([Pay Date]) AS MaxDate,
Min([Pay Date]) AS MinDate
RESIDENT MyData;
LET varMinDate = Num(Peek('MinDate',0,'MinMax')); // 0 is first record
LET varMaxDate = Num(Peek('MaxDate',-1,'MinMax')); // -1 is last record
LET varToday = Num(Today());
MasterCalendar:
LOAD
monthstart([Pay Date]) >= monthstart(AddMonths(Today(),-12)) as PaidInLast12MonthsFlag,
dual(date(makedate(year([Pay Date]),num(month([Pay Date]))),'MMM-yyyy'),year([Pay Date]) * 100 + num(month([Pay Date]))) as PayMonthYear
[Pay Date];
LOAD
date($(varMinDate) + RecNo() - 1,'DD/MM/YYYY') as [Pay Date]
AUTOGENERATE num($(varMaxDate)) - num($(varMinDate)) + 1;
DROP TABLE MinMax;
So, in the above, the field PaidInLast12MonthsFlag is equal to -1 if the value of the [Pay Date] field occurs in the last 12 months, 0 otherwise. You could use this in your set analysis expression as a filter. Furthermore, you can use PayMonthYear as your chart dimension.

Modifying date in ColdFusion

How can I adjust a date in coldfusion to get the next day at 1AM?
the date is taken from a database, and stored as a string. I'm thinking the way to do it is through CreateDateTime and filling it with the time and date using year,month,day + 1 etc.
I'm just worried that it won't work when the next day falls on the next month
Using DateAdd() you can always be sure that it will take the context of the current date into account. So if it is August 31 and you add one day it will correctly make the date Sept 1st. It will also properly switch the year if you did the same on Dec 31st.
<cfset nextDate = dateAdd("d", 1, now()) />
<cfset nextDateWithTime = createDateTime(year(nextDate), month(nextDate), day(nextDate), 1, 0, 0) />
<cfoutput>#nextDateWithTime#</cfoutput>
Assuming the date is something which CF recognizes as a date, and contains date only, without time, you could do something like:
<cfscript>
function tomorrowOneAM(date) {
var resultValue = DateAdd("d",1,date);
resultValue = DateAdd("h",1,resultValue);
return resultValue;
}
</cfscript>