Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with Timezome

    We have the next problem with the timezone behavior:

    Versión SmartGWTpro 4.0. Every browsers involved

    On gmt-5 time zone client configuration

    If we have the next EntryPoint configuration
    /**
    * First method executed when a GWT page is opened
    */
    public void onModuleLoad() {
    //SC.showConsole();
    String cdSection = com.google.gwt.user.client.Window.Location.getParameter("cdSection");
    if(cdSection==null){
    //This is for the initial page
    }else{
    FocussClientServiceCaller.getSectionConfig(this, Integer.parseInt(cdSection));
    }

    /**
    * Set Default module config
    */
    setDefaultModuleConfig();
    }

    /**
    * Set default module configuration
    */
    public void setDefaultModuleConfig(){
    DateUtil.setDefaultDisplayTimezone("00:00");
    DateUtil.setAdjustForDST(false);

    }

    Then the fetch rest data response by a date column is ok without adding hours
    Error 1 : When the end user sets 28/01/2014 00:00:00 from a column date chooser into the list grid then the header column shows 27/01/2014 19:00:00 in the text field of the date chooser but in the server side is ok 28/01/2014 00:00:00

    Error 2 : The same behavior in MiniDateRangeItem
    The method for configuring the list grid columns is:
    public void configGridAndDatasourceFields(ListGrid grid,RestDataSource dataSource,List<RolDTO> rolDTOList){

    try {
    DataSourceField[] dataSourceFields = new DataSourceField[window.getSectionConfig().getSelectedView().getColumns().size()];
    ListGridField[] listGridFields = new ListGridField[window.getSectionConfig().getSelectedView().getColumns().size()];

    LinkedHashMap<String,Boolean> checkBoxValueMap = Constant.getCheckBoxValueMap();
    LinkedHashMap<SQLServerType,FieldType> dataTypes = Constant.getMatchSQLGWTTypes();
    LinkedHashMap<SQLServerType,ListGridFieldType> listGridDataTypes = Constant.getMatchListGridTypes();
    int fieldItem = 0;

    for (ColumnConfig columnConfig: window.getSectionConfig().getSelectedView().getColumns()) {
    DataSourceField field = new DataSourceField();

    //DataSourceField field2 = null;
    //com.google.gwt.user.client.Window.alert(columnConfig.getCdColumn());

    if(checkBoxValueMap.get(columnConfig.getIsPrimaryKey())){
    this.cdColumnPK = columnConfig.getCdColumn();
    }

    field = new DataSourceField(columnConfig.getCdColumn(),
    dataTypes.get(SQLServerType.getTypeByString(columnConfig.getDsType())),
    columnConfig.getDsName(),
    columnConfig.getColumnSize(),
    !checkBoxValueMap.get(columnConfig.getIsNullable()));

    field.setPrimaryKey(checkBoxValueMap.get(columnConfig.getIsPrimaryKey()));
    if( checkBoxValueMap.get(columnConfig.getIsPrimaryKey())){
    field.setSummaryFunction(SummaryFunctionType.COUNT);
    }



    boolean editPermissionEnable = window.getSectionConfig().getSelectedView().editPermission(columnConfig,rolDTOList);

    if (editPermissionEnable) {
    if(window.getSectionConfig().getSelectedView().getIndicator() != null)
    field.setCanEdit(false);
    else
    field.setCanEdit(checkBoxValueMap.get(columnConfig.getIsEditable()));
    } else {
    field.setCanEdit(false);
    }

    if (columnConfig.getViewType().equals(Constant.LIST_TYPE.getValue())) {
    field.setValueMap(columnConfig.getListColumnValueMap());

    }

    if (columnConfig.getDsType().equals(SQLServerType.BOOLEAN.getType())) {
    field = new DataSourceBooleanField(columnConfig.getCdColumn(), columnConfig.getDsName(), columnConfig.getColumnSize());
    }

    if( checkBoxValueMap.get(columnConfig.getIsPrimaryKey())){
    //com.google.gwt.user.client.Window.alert(columnConfig.getCdColumn()+" - "+window.getSectionConfig().getCdModule()+" - "+window.getSectionConfig().getSectionType().getCode()+"-"+window.getSectionConfig().getSectionSubtype());
    if((window.getSectionConfig().getDsSection().equals(Constant.MODULE_PRODUCTION_FAMILY.getValue()))||(window.getSectionConfig().getDsSection().equals(Constant.MODULE_FREQUENT_CAUSES.getValue()))){
    //com.google.gwt.user.client.Window.alert("entra a validar con columna"+columnConfig.getCdColumn());
    //field.setHidden(true);
    field.setCanView(false);
    }
    }

    /*
    * if it is Custom Fields option and the column is CDCOLUMN or IS_SYSTEM, then hide it
    */
    if ((window.getSectionConfig().getDsSection().equals(Constant.MODULE_CUSTOM_FIELDS.getValue())) &&
    (columnConfig.getCdColumn().equals(CustomColumnsEnum.FIELDS_CDCOLUMN.getValue()) ||
    columnConfig.getCdColumn().equals(CustomColumnsEnum.FIELDS_IS_SYSTEM.getValue()) )){
    field.setCanView(false);
    }

    /*
    * if it is Parameters option and the column is CDPARAM, then hide it
    */
    if ((window.getSectionConfig().getDsSection().equals(Constant.MODULE_PARAMETERS.getValue())) &&
    (columnConfig.getCdColumn().equals(Constant.PARAM_COLUMN_CDPARAM.getValue())) ){
    field.setCanView(false);
    }

    dataSourceFields[fieldItem] = field;

    ListGridField gridField = new ListGridField();
    gridField.setType(listGridDataTypes.get(SQLServerType.getTypeByString(columnConfig.getDsType())));
    gridField.setRequired(!checkBoxValueMap.get(columnConfig.getIsNullable()));

    if (columnConfig.getCdColumn().equals("ORDER_NOTES")) {
    gridField = new ListGridField(columnConfig.getCdColumn(), columnConfig.getDsName(), columnConfig.getColumnWidth());
    gridField.setAlign(Alignment.LEFT);
    gridField.setValueField("");
    } else {
    gridField = new ListGridField(columnConfig.getCdColumn(), columnConfig.getDsName(), columnConfig.getColumnWidth());
    gridField.setAlign(Alignment.LEFT);
    }

    if (columnConfig.getCdColumn().equals(CustomColumnsEnum.FIELDS_CDPERMISSION_EDIT.getValue())) {
    gridField.setEmptyCellValue(Constant.DEFAULT_PERMISSION.getValue());
    gridField.setDefaultValue(Constant.DEFAULT_PERMISSION.getValue());
    }

    /*
    * If it is Location section, then, assign default Calendar Code if any
    */
    if (window.getSectionConfig().getDsSection().equals(Constant.MODULE_LOCATIONS.getValue())){
    if (columnConfig.getCdColumn().equals(LocationColumnsEnum.LOCATION_CDCALENDAR.getValue())) {
    gridCalendarField = gridField;
    FocussClientServiceCaller.getPredefinedCalendar(this);
    }
    }

    if((columnConfig.getDsType().equals(SQLServerType.NUMERIC.getType())&& !checkBoxValueMap.get(columnConfig.getIsPrimaryKey())) || columnConfig.getDsType().equals(SQLServerType.DATETIME.getType())){
    gridField.setShowGridSummary(false);
    }

    if(columnConfig.getDsType().equals(SQLServerType.DATETIME.getType())){
    gridField.setShowGroupSummary(false);
    }


    if( checkBoxValueMap.get(columnConfig.getIsPrimaryKey())||columnConfig.getCdColumn().equals(Constant.DSFAMILY_COLUMN.getValue())
    || columnConfig.getCdColumn().equals(Constant.CDLOCATION_COLUMN.getValue()) ||columnConfig.getCdColumn().equals(Constant.DSCAUSE_COLUMN.getValue())
    || columnConfig.getCdColumn().equals(Constant.CDORDER_COLUMN.getValue())){

    //gridField.setIncludeInRecordSummary(true);
    gridField.setShowGridSummary(true);
    gridField.setSummaryFunction(SummaryFunctionType.COUNT);

    //com.google.gwt.user.client.Window.alert(columnConfig.getCdColumn()+" - "+window.getSectionConfig().getCdModule()+" - "+window.getSectionConfig().getSectionType().getCode()+"-"+window.getSectionConfig().getSectionSubtype());
    //if((window.getSectionConfig().getCdModule()==1)&&(window.getSectionConfig().getSectionType().getCode().equals(Constant.WINDOW_OPEN_MODE_C.getValue())) && (window.getSectionConfig().getSectionSubtype() == null)){
    if((window.getSectionConfig().getDsSection().equals(Constant.MODULE_PRODUCTION_FAMILY.getValue()))||(window.getSectionConfig().getDsSection().equals(Constant.MODULE_FREQUENT_CAUSES.getValue()))){
    //com.google.gwt.user.client.Window.alert("entra a validar con columna"+columnConfig.getCdColumn());
    gridField.setHidden(true);
    }
    }

    /*
    * if it is Custom Fields option and the column is CDCOLUMN or IS_SYSTEM, then hide it
    */
    if ((window.getSectionConfig().getDsSection().equals(Constant.MODULE_CUSTOM_FIELDS.getValue())) &&
    (columnConfig.getCdColumn().equals(CustomColumnsEnum.FIELDS_CDCOLUMN.getValue()) ||
    columnConfig.getCdColumn().equals(CustomColumnsEnum.FIELDS_IS_SYSTEM.getValue()) )){
    field.setCanView(false);
    }

    /*
    * if it is Parameters option and the column is CDPARAM, then hide it
    */
    if ((window.getSectionConfig().getDsSection().equals(Constant.MODULE_PARAMETERS.getValue())) &&
    (columnConfig.getCdColumn().equals(Constant.PARAM_COLUMN_CDPARAM.getValue())) ){
    field.setCanView(false);
    }

    getFormatColumn(gridField, columnConfig);

    listGridFields[fieldItem] = gridField;

    grid.setSortField(fieldItem);

    fieldItem++;

    //PENDIENTE com.google.gwt.user.client.Window.alert(columnConfig.getCdColumn());
    }

    dataSource.setFields(dataSourceFields);

    grid.setFields(listGridFields);

    } catch (Exception e) {
    e.printStackTrace();
    com.google.gwt.user.client.Window.alert("----"+e.getMessage());
    throw new RuntimeException(e);
    }

    }


    Scenario 2 :
    If we have the next entryPoint configuration:
    public void onModuleLoad() {
    //SC.showConsole();
    String cdSection = com.google.gwt.user.client.Window.Location.getParameter("cdSection");
    if(cdSection==null){
    //This is for the initial page
    }else{
    FocussClientServiceCaller.getSectionConfig(this, Integer.parseInt(cdSection));
    }

    /**
    * Set Default module config
    */
    setDefaultModuleConfig();
    }
    /**
    * Set default module configuration
    */
    public void setDefaultModuleConfig(){
    DateUtil.setDefaultDisplayTimezone("-05:00");
    DateUtil.setAdjustForDST(false);

    }
    Then the date chooser from the list grid header and the MiniDateRangeItem(in another form) show the correct date but they send to the server side (via rest data source) a wrong date, adding 5 hours (according to the gmt-5) and the query in the server side returns fewer records than I expect. Eg 28/01/2013 15:30:50 in the client side is 28/01/2013 10:30:50 in the server side.

    We will appreciate your support.

    #2
    Please read the Date and Time Format and Storage overview - date and time values are surprisingly difficult to manipulate properly, and we receive many "bug reports" in this area that are not actually bugs.

    If, after reading the overview, you are convinced you've found a framework flaw, please post a *minimal*, ready-to-run test case demonstrating the issue. There should be no code other than the code required to clearly replicate the issue, and no external dependencies.

    Comment


      #3
      Seems like any of use that deal with clients in a different timezone than the server have these issues but Isomorphic just keeps saying to read the doc that I have read several times and refuses to actually look into the issue.

      There is a couple of other posts basically have timezone issues with dates when client timezone is different than server.

      Unfortunately there does not seem to be any real attention to fixing this or stating exactly how we can handle it.

      Comment


        #4
        Seems like any of use that deal with clients in a different timezone than the server have these issues ...
        Ah, that must be it. All of Isomorphic's multinational customers are in the same timezone!

        You posted several comments across the forums today with a similar complaint.

        These comments definitely are not helping you or others.

        What would help is to carefully read the Date and Time Format and Storage overview, and if you think you've found a bug, post a clear test case, avoiding all the pitfalls noted in that document.

        Comment

        Working...
        X