Discussion:
gwt datetime set date
g***@gmail.com
2018-09-04 20:31:56 UTC
Permalink
I am completely unfamiliar with gwt ajax, I need to maintain a project
using gwt 2.6.1, is it possible to set the end year of this javascript
control DateItem
for example year 2030, could it beem limited to 2020 :

dateItem = new DateItem("expDate");
dateItem.setTitle(DEManager.I18N_CST.uploadExpirationDateLbl());

dateItem.setColSpan(4);
dateItem.setWidth(190);// guglielmo was 90 test !
dateItem.setEndDate(new Date(2030,1,1) );// is it possible to set
the date to 2030 ? **********************************
dateItem.addChangedHandler(new ChangedHandler() {
@Override
public void onChanged(ChangedEvent event) {
resetFieldError(dateItem.getName());

expiration.setValue(EXP_DATE_FORMAT.format(dateItem.getValueAsDate()) + "-"
+ EXP_TIME_FORMAT.format((Date) timeItem.getValue()));
}
});

it seems to default to 1995-2020, is it possible ?
thank you for any clues.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Jens
2018-09-05 06:37:14 UTC
Permalink
Post by g***@gmail.com
dateItem = new DateItem("expDate");
This is not a GWT SDK class, so no idea if you will get useful answers here.
Post by g***@gmail.com
dateItem.setEndDate(new Date(2030,1,1) );// is it possible to set
the date to 2030 ? **********************************
java.util.Date constructor takes a year from which you have to subtract
1900 (see Javadoc). So for year 2030 you would need to use new
Date(2030-1900, 1, 1)


-- J.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Loading...