0

1981年より前の入力コントロールの夏の日付が再計算されます(夏時間で考えます)。

たとえば、27.8.1960と入力します-保存後は26.8.1960を取得しましたが(次の保存後は25.8.1960など)、27.8.2010-保存後も同じままでした:27.8.2010

「冬の日付」:27.4.1960-保存後も同じままでした:27.4.1960

醜いバグのように見えます。この「計算」をどのように抑えることができますか?

(日付形式はヨーロッパ人です。私はドイツに住んでいます。27.8.1960は1960年8月27日です)

助けてくれてありがとう、Uwe

<xp:inputText value="#{Auftrag.MF_GebDatum}" id="mF_GebDatum1" style="width:255px">
    <xp:this.converter>
        <xp:convertDateTime type="date"></xp:convertDateTime>
    </xp:this.converter>
</xp:inputText>
4

1 に答える 1

0

The problem you are fighting with is that Domino stores a datetime value with the daylight saving information which does not exists for the dates you are entering. The information for the timezone to use comes from the current user locale and / or the server.

Your date is stored in a field with the timezone it was entered (+2h GMT)

26.08.1960 00:00:00 CEDT

Domino interprets the stored value as it is, without adjusting it

var ndt:NotesDateTime = session.createDateTime("26.08.1960 00:00:00 CEDT");
ndt.getGMTTime()

returns the correct datetime value, adjusted by 2 hours for GMT

25.08.60 22:00:00 GMT

While converted back to Java, it is interpreted "correctly" that there was never a daylight saving time in 1960, that's why it will be adjusted only by 1 hour:

var ndt:NotesDateTime = session.createDateTime("26.08.1960 00:00:00 CEDT");
ndt.toJavaDate().toLocaleString()

will result in "25.08.1960 23:00:00" if you are in the CEDT timezone.

Currently the only idea I have for an easy workaround is to kill the Timezone information in the DateTime field. To do this you can use this SSJS script:

<xp:this.querySaveDocument>
   <![CDATA[#{javascript:
      var doc:NotesDocument = document1.getDocument( true );
      var items:java.util.Vector = doc.getItems();
      var item:NotesItem;
      var ndt:NotesDateTime;
      var dt:java.util.Date;

      for( var i=0; i<items.size(); i++){
         item = items.get(i);
         if( item.getType() === 1024 ){
            ndt = item.getValueDateTimeArray().get(0);  
            ndt = session.createDateTime( ndt.getDateOnly());
            item.setDateTimeValue( ndt );
            ndt.recycle();
         }
         item.recycle();
      }
   }]]>
</xp:this.querySaveDocument>
于 2013-01-14T10:33:54.347 に答える