JIRA : default date class override - java

We are trying to change JIRA default display dates to shamsi/jalali Date (Persian date).
Is it possible to write a plugin to override the default date format display of JIRA? How?

Related

Always save date to today's date in database using jhipster

I have created one entity in jhipster using jhipster-jdl.jh file which is as shown below:
entity EmployeeLeave{
appliedDate LocalDate required,
fromDate LocalDate required,
toDate LocalDate required,
status String
}
From these fields i want appliedDate as today's date in database(MySql).
I have tried this from Angular side in jhipster code but none helps well.
Is there any way so that when creating a record for employeeLeave there should be always appliedDate equals to today's date.
Preferably i want solution from Angular side. Other solutions are also welcomed.
Technologies:
Database: Mysql,
Spring-boot,
Angular 4,
Jhipster.
You can initialize your date inside your class :
public class EmployeeLeave{
LocaleDate yourDate = LocaleDate.now();
//other fields
}
So, appliedDate will always be today's date. I am using Java 8 but the idea is here.
LocaleDate.now() is server time. If server is in another time zone than user, may insert incorrect date.
Isn't better to define date in .controller.js like:
var now = new Date();
vm.employeeLeave.appliedDate=now;
vm.isSaving = true;
EmployeeLeave.update(vm.employeeLeave, onSaveSuccess, onSaveError);
?

Vaadin datefield component set a default date

My question is if I put a date field in my web application's UI using vaadin framework like following codes, then how can I set a default date value to it? I can also see the setValue() method suggestion coming with date field in eclipse editor but has not much information how to set a particular date with setValue() in its documentation.
DateField dueDate = new DateField();
dueDate.setDateFormat("dd-MM-yyyy");
dueDate.setVisible(true);
dueDate.setCaption("Due Date");
**dueDate.setValue();**
Thanks in advance for your concerns. I am using vaadin7.
It's indeed the setValue method you need to call. You can supply a java.util.Date object. The first code example on this documentation page shows it.
// Create a DateField with the default style
DateField date = new DateField();
// Set the date and time to present
date.setValue(new Date());
If you are on Java 8 and want to use a LocalDate or LocalDateTime, you need to convert it to java.util.Date or write a Converter for the DateField (I did that some time ago, see here).

Serialize Date: Swagger and Spring-MVC

I'm using swagger-ui and a stub server in Java Spring-MVC generated using swagger-codegen. I have a date format somewhere and if I enter some date, it always returns me the UNIX Date Time format. I would like to have the RFC-3339 format for the date and date-time. Does anyone knows how to do this?
I found the answer..
I had to overwrite the JsonFormat since I'm returning a JSON object..
Therefore, if you have the same problem as me, use:
#JsonFormat(pattern="...")
Date foo;
Do not forget to use import com.fasterxml.jackson.annotation.JsonFormat;

RichFaces 4.2 Calendar. How can I set the InputField of Calendar by JavaScript?

I have to copy a Date String at client side to the Calendar input field "renewal_date_input". The following JavaSript did not work:
document.getElementById('AddressDetails:renewal_date_input').value = renewalDateCombo.value.toString();
Although with:
alert("written date is: " + document.getElementById('AddressDetails:renewal_date_input').value);
We can read out the correct date string written previously.
But the string does not appear in the input field.
Manual Input is enabled:
enableManualInput="true"
Perhaps the JavaScript Function setInputField: function(dateStr, event) shipped with rich faces calendar.js could help, but how do I use it?
Use the setValue() function on the date component, passing a Date object as argument
var theCalendar = document.getElementById('AddressDetails:renewal_date_input');
theCalendar.setValue(document.getElementById('AddressDetails:renewal_date_input').getValue()); //Here I assume renewal_date_input is also a calendar component

RichFaces 4.2 Calendar - How to set the Input Field of Calendar by JavaScript? [duplicate]

I have to copy a Date String at client side to the Calendar input field "renewal_date_input". The following JavaSript did not work:
document.getElementById('AddressDetails:renewal_date_input').value = renewalDateCombo.value.toString();
Although with:
alert("written date is: " + document.getElementById('AddressDetails:renewal_date_input').value);
We can read out the correct date string written previously.
But the string does not appear in the input field.
Manual Input is enabled:
enableManualInput="true"
Perhaps the JavaScript Function setInputField: function(dateStr, event) shipped with rich faces calendar.js could help, but how do I use it?
Use the setValue() function on the date component, passing a Date object as argument
var theCalendar = document.getElementById('AddressDetails:renewal_date_input');
theCalendar.setValue(document.getElementById('AddressDetails:renewal_date_input').getValue()); //Here I assume renewal_date_input is also a calendar component

Categories