Does anyone have any experience using the GWT-Ext DatePicker.setDisabledDatesRE(String re) method? I have done the following, and the dates specified in the regular expressions are still selectable. I have been able to disable dates using setDisabledDays, but I need to exclude dates based on criteria other than day of week.
I'm using GWT 1.6.4 and GWT-Ext 2.0.5.
Thanks.
...
import com.gwtext.client.widgets.DatePicker;
...
public class MySimpleDatePicker implements EntryPoint {
public void onModuleLoad() {
final Panel panel = new Panel();
final Panel calendarPanel = new Panel();
DatePicker datePicker = new DatePicker();
Date initialDate = new Date();
datePicker.setFormat("yyyy-mm-dd");
datePicker.setValue(initialDate);
String ddRE = "2009-09-28|2009-09-29";
datePicker.setDisabledDatesRE(ddRE);
calendarPanel.add(datePicker);
panel.add(calendarPanel);
RootPanel.get().add(panel);
}
}
I figured this out. The argument to setFormat should be "Y-m-d", like this:
DatePicker datePicker = new DatePicker();
Date initialDate = new Date();
datePicker.setFormat("Y-m-d");
System.out.println("date format is: " + datePicker.getFormat());
datePicker.setMinDate(initialDate);
datePicker.setValue(initialDate);
String ddRE = "09-09-28|09-09-29";
datePicker.setDisabledDatesRE(ddRE);
Related
I am trying to run a query at the repository level of my nestjs application.
The date format of the column (runDateTime) in my DB is isoString. I want to find all the records that have runDateTime of today's date.
I have a function called Parsebackenddate that essentially converts iso string to YYYY-MM-DD. how do i use this function with "schedule.runDateTime" in order to compare both dates in the format YYYY-MM-DD?
Or is there an alternative?
if (getToday) {
const todayDate = dayjs().format('YYYY-MM-DD');
query.where('schedule.runDateTime = :todayDate', {
todayDate,
});
``
Much appreciated.
first, you have to get a date from the database and hold it in a class variable then compare.
something like that may this could help.
var _orderBean = new date_beans();
_orderBean.dueDate = _response[a].dueDate.toISOString().slice(0,10); //YYYY-MM-DD
then compare
var d = new Date(); //todaydate
if(d.toISOString().slice(0,10)>_orderBean.dueDate)
// TodayDate > DueDate
I have absolutly no idea of what I'm doing but I'm trying to import CSV data from API output into a google sheets.
The data I want to import are bookings data, aleady generated as a csv file and I simply need to import all the data the first time and then update it (no need to re-import all the datas from last year)
The API URL is:
https://www.beds24.com/api/csv/getbookingscsv
I need however to enter my username and my password and if necessary a date range.
So in my head it would be:
One script for the year booking import
username XXXXX
password •••••
datefrom
dateto
One script for the day booking import using the date range
username XXXXX
password •••••
datefrom 2019-09-29
dateto 2019-09-29
The first look I took using googlescript I found out that I would probably need something like this:
function importCSV() {
var var bookings = beds24api.beds24GetBookings(prop_key, data_option);
var res = UrlFetchApp.fetch("https://www.beds24.com/api/csv/getbookingscsv");
var content = res.getContentText();
var authentication = {
'authentication' : {
'username' : XXXXX,
'password' : •••••
};
};
}
function beds24GetBookingsCSV(username, password, data_option){
return beds24JsonApi('https://www.beds24.com/api/csv/getbookingscsv',username, password, data_option);
};
return {
beds24GetBookings: beds24GetBookingsCSV,
};
}
Lot of you gonna get bleding eyes from this code but if I could get some help acheiving this that would be awesome!
I have no experience with beds24 nor do I wish to. But if you look here you will find an example of UrlFetchApp.fetch(url, options);. I believe that you'll need to include your authentication data into the options object or include them as elements of the querystring portion of the url. Look to see in beds 24 has a Google Apps Script example or possibly a Javascript example.
String url = "https://www.beds24.com/api/csv/getbookingscsv";
URL obj = new URL(url);
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
con.setRequestMethod("POST");
String params = "username=XXX&password=YYY";
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(params);
wr.flush();
BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
System.out.println(response.toString());
# Function to get data from Beds24 API
getBeds24Data <-function(username = property_mgmt$username,
password = property_mgmt$password,
datefrom = "2019-01-01",
dateto = "2019-12-30"){
url <- "https://www.beds24.com/api/csv/getbookingscsv"
response <- httr::POST(url=url, body = list("username" = username,
"password"=password,
datefrom = datefrom,
dateto = dateto))
beds24Data <- httr::content(response,type='text/csv',col_names=T,col_types=NULL)
return(beds24Data)
}
I'm trying to compare the date of videos on a webpage to today's date. If the difference between the two dates is more than X days, report back as false.
The videos on the webpage have a tag in them which uses the format yyyy-mm-dd
I've got a selector set up to find the videos const videoDate = Selector('OPTA-video').withAttribute('data-secondary-time')
Now how do I set a variable to today's date and compare the two? I'm completely stuck!
I was using Katalon Studio before and here's the groovy script that did the same job:
String videoDate = WebUI.getAttribute(findTestObject('OPTA-video'), 'data-secondary_time')
LocalDate todaysDate = LocalDate.now()
LocalDate videoDateParsed = LocalDate.parse(videoDate, dtf)
if (ChronoUnit.DAYS.between(videoDateParsed, todaysDate) > 1) {
KeywordUtil.markFailed('The videos are 2+ days old.')
} else {
KeywordUtil.logInfo('The videos are up to date.')
}
You can use the getAttribute TestCafe method to access an attribute value. Then, parse the attribute value into the JavaScript Date object:
String videoDate = Selector('OPTA-video').getAttribute('data-secondary-time');
Date videoDateParsed = Date.parse(videoDate);
Date todaysDate = Date.now()
...
In the following thread you can find how to compare Date objects.
This is one of the scripts that I am using.
//getting your XPath test value into a string
String ann_time =
WebUI.getText(findTestObject("ObjectRepository/navigateTOElement/announcements_date"))
//converting time to simple date format
SimpleDateFormat sdf = new SimpleDateFormat('HH:mm')
Date sdf_anntime = sdf.parse(new String(ann_time))
//getting Current time
SimpleDateFormat dateFormatGmt = new SimpleDateFormat('HH:mm')
dateFormatGmt.setTimeZone(TimeZone.getTimeZone('GMT'))
SimpleDateFormat dateFormatLocal = new SimpleDateFormat('HH:mm')
currDate = dateFormatLocal.parse(dateFormatGmt.format(new Date()))
// time gap in long format
long duration = currDate.getTime() - sdf_anntime.getTime()
//time gap to mins
long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(duration)
//compare time gap with globale variable
if (diffInMinutes < GlobalVariable.News_updated_time) {
log.logInfo("system is getting updated,last updated "+ diffInMinutes + "min ago")
} else {
CustomKeywords.'errorMessage.logFailed.markStepFailed'('from 1 h, system was not updated')
log.logInfo('from '+ diffInMinutes+ 'h, system was not updated')
}
I have a requirement to create a business service function to calculate expiry date , 2 weeks from a date field in Siebel.
I have written the code in Java which is
public static Date checkexpiry(Date Datefield)
{
Calendar cal = Calendar.getInstance();
cal.setTime(Datefield);
cal.add(Calendar.DATE, -14);
Date twoWeeksToExpiry = cal.getTime();
System.out.println(twoWeeksToExpiry);
return twoWeeksToExpiry;
}
if current date is equal to twoWeeksToExpiry {do .....}
So how can I re-write this code on Siebel using a business service particularly E-script.
The whole idea is have an output Yes is its 2 weeks before a date field in Siebel.
This will later be used in a work flow.
OK so have started Migrating my Java coding skills to Siebel E-Script I came up with this.
function ExpiryNotification(Inputs,Outputs)
{
try
{
var expiryDate = Inputs.GetProperty("DateField");
var eDate= new Date(expiryDate);
var notificationdate = eDate-14;
var currentdate = Today();
if (currentdate==notificationdate){
Outputs.SetProperty("Notification", "Y")
}
else {
Outputs.SetProperty("Notification", "N")
}
catch(e)
{
TheApplication().RaiseErrorText(e.toString());
}
}
However I did not use the Business Service ..I used a calculated field on my Business Component.
The calculated Fields
1 twoWeeksToExpiry = Datefield-14
Notification = IIf (Today()==[twoWeeksToExpiry], "Y", "N")
So this solved the problem without scripting,
Will appreciate any suggestions on my scripting thou I didn't use it.
i'm trying to manipulate somme specific things with google events, i can add, delete, get all events and put colors on events, But i Have a problem , each time i ty to insert a recurring event , i get not valid timezone message and i don't know how to fix it :/
This my code :
public void AddRecurringEvents(Calendar service, Event createdEvent,
String rule, String Summary, String Location) {
Event event = new Event();
// Define Date Time for each start and end time.
DateTime start = DateTime.parseRfc3339("2014-09-30T10:00:00Z");
DateTime end = DateTime.parseRfc3339("2014-09-30T10:25:00Z");
event.setStart(new EventDateTime().setDateTime(start).setTimeZone(
"Europe/Paris"));
event.setEnd(new EventDateTime().setDateTime(end).setTimeZone(
"Europe/Paris"));
// Setting recurrence
event.setRecurrence(Arrays.asList(rule));
try {
Event recurringEvent = service.events().insert("primary", event)
.execute();
System.out.println(createdEvent.getId());
} catch (IOException e) {
e.printStackTrace();
}
}
Any ideas how to fix this problem ?? is there something wrong with my code ...
THanks
Try something like this:
Event event = new Event();
event.setSummary(en.name);
event.setDescription(en.desc);
event.setStatus("confirmed");
ArrayList<String> recurrence = new ArrayList<String>();
recurrence.add("RRULE:FREQ=YEARLY;WKST=MO;");
event.setRecurrence(recurrence);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(en.year, en.month-1, en.day,0,0,0);
Date startDate = cal.getTime();
Date endDate = new Date(startDate.getTime()); // same Time
DateTime start = new DateTime(startDate, TimeZone.getTimeZone("Europe/Paris"));
event.setStart(new EventDateTime().setDateTime(start).setTimeZone("Europe/Paris"));
DateTime end = new DateTime(endDate, TimeZone.getTimeZone("Europe/Paris"));
event.setEnd(new EventDateTime().setDateTime(end).setTimeZone("Europe/Paris"));
Event createdEvent = client.events().insert( "primary", event).execute();