Skip to content

Commit

Permalink
bugfix convert date
Browse files Browse the repository at this point in the history
  • Loading branch information
isayan committed Oct 16, 2022
1 parent 1d8cce0 commit 48ece8f
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 118 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
netbeans.org-netbeans-modules-javascript2-requirejs.enabled=true
release_version_major=2.2
release_version_minor=13.6
release_version_minor=13.7
Binary file modified release/YaguraExtender-v2.2.jar
Binary file not shown.
29 changes: 22 additions & 7 deletions src/main/java/extend/util/external/TransUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
Expand Down Expand Up @@ -2399,20 +2402,32 @@ public static char getOrderdChar(int ord) {
/*
* DateへはZoneがデフォルトのZoneになるため強制的に変更
*/
public static Date toZoneWithDate(LocalDateTime ldtm) {
GregorianCalendar cal = new GregorianCalendar(ldtm.getYear(), ldtm.getMonthValue(), ldtm.getDayOfMonth(), ldtm.getHour(), ldtm.getMinute(), ldtm.getSecond());
public static Date toZoneWithDate(LocalDateTime ldtm, ZoneId zoneId) {
GregorianCalendar cal = new GregorianCalendar(ldtm.getYear(), ldtm.getMonthValue()-1, ldtm.getDayOfMonth(), ldtm.getHour(), ldtm.getMinute(), ldtm.getSecond());
cal.setTimeZone(TimeZone.getTimeZone(zoneId));
return cal.getTime();
}

/*
* DateへはZoneが
* DateへはZoneがデフォルトのZoneになるため強制的に変更
*/
public static LocalDateTime toZoneWithLocalDate(Date date) {
// public static LocalDateTime toZoneWithLocalDate(Date date, ZoneId zoneId) {
// Calendar cal = GregorianCalendar.getInstance();
// cal.setTimeZone(TimeZone.getTimeZone(zoneId));
// cal.setTime(date);
// LocalDateTime ldtm = LocalDateTime.of(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
// return ldtm;
// }

/*
* DateへはZoneがデフォルトのZoneになるため強制的に変更
*/
public static ZonedDateTime toZoneWithZoneDate(Date date, ZoneId zoneId) {
Calendar cal = GregorianCalendar.getInstance();
//cal.setTimeZone(TimeZone.getTimeZone(zoneId));
cal.setTime(date);
LocalDateTime ldtm = LocalDateTime.of(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
return ldtm;
ZonedDateTime zdtm = ZonedDateTime.of(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), 0, zoneId);
return zdtm;
}


}
89 changes: 45 additions & 44 deletions src/main/java/yagura/view/JTransCoderTab.form
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-60,0,0,8,10"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-60,0,0,8,16"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
Expand Down Expand Up @@ -1429,7 +1429,7 @@
</Group>
</Group>
</Group>
<EmptySpace pref="1520" max="32767" attributes="0"/>
<EmptySpace pref="1526" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -1551,7 +1551,7 @@
</Group>
</Group>
</Group>
<EmptySpace pref="1467" max="32767" attributes="0"/>
<EmptySpace pref="1473" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -1698,7 +1698,7 @@
<Component id="pnlCount" min="-2" pref="240" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="1467" max="32767" attributes="0"/>
<EmptySpace pref="1473" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -2003,7 +2003,7 @@
<Group type="102" alignment="0" attributes="0">
<Component id="lblBin" min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtBin" pref="1907" max="32767" attributes="0"/>
<Component id="txtBin" pref="1913" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="lblHex" min="-2" pref="55" max="-2" attributes="0"/>
Expand Down Expand Up @@ -2252,7 +2252,7 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblIPValid" min="-2" pref="256" max="-2" attributes="0"/>
<EmptySpace pref="1422" max="32767" attributes="0"/>
<EmptySpace pref="1428" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -2446,71 +2446,71 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblJavaSerial" alignment="0" max="32767" attributes="0"/>
<Component id="lblZoneDate" max="32767" attributes="0"/>
<Component id="lblUnixtime" alignment="0" max="32767" attributes="0"/>
<Component id="lblExcelSerial" alignment="0" pref="425" max="32767" attributes="0"/>
<Component id="lblExcelSerial" max="32767" attributes="0"/>
<Component id="lblJavaSerial" alignment="1" max="32767" attributes="0"/>
<Component id="lblZoneDate" min="-2" pref="120" max="-2" attributes="0"/>
<Component id="lblDate" alignment="0" max="32767" attributes="0"/>
<Component id="lblUnixtime" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtUnixtime" alignment="0" max="32767" attributes="0"/>
<Component id="txtJavaSerial" alignment="0" max="32767" attributes="0"/>
<Component id="txtExcelSerial" alignment="0" max="32767" attributes="0"/>
<Component id="spnZoneDateTime" alignment="0" pref="638" max="32767" attributes="0"/>
<Component id="txtSystemZoneDate" alignment="0" max="32767" attributes="0"/>
<Component id="spnZoneDateTime" alignment="0" max="32767" attributes="0"/>
<Component id="txtUnixtime" max="32767" attributes="0"/>
<Component id="txtExcelSerial" pref="626" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btnUnixtimeCopy" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="btnJavaSerialCopy" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="btnExcelSerial" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="cmbTimezone" min="-2" pref="261" max="-2" attributes="0"/>
<Component id="btnZoneDateCopy" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="btnExcelSerial" min="-2" pref="90" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="716" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="1039" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spnZoneDateTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmbTimezone" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblZoneDate" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cmbTimezone" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
<Component id="spnZoneDateTime" min="-2" max="-2" attributes="0"/>
<Component id="lblZoneDate" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblDate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnZoneDateCopy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtSystemZoneDate" alignment="3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="lblDate" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="txtSystemZoneDate" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="btnZoneDateCopy" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btnUnixtimeCopy" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblUnixtime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtUnixtime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="lblUnixtime" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="txtUnixtime" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="btnUnixtimeCopy" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblJavaSerial" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnJavaSerialCopy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtJavaSerial" alignment="3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="lblJavaSerial" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="txtJavaSerial" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="btnJavaSerialCopy" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblExcelSerial" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnExcelSerial" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtExcelSerial" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="lblExcelSerial" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="txtExcelSerial" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="btnExcelSerial" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="495" max="32767" attributes="0"/>
<EmptySpace pref="493" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -2567,7 +2567,7 @@
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="editor" type="javax.swing.JComponent" editor="org.netbeans.modules.form.editors.SpinnerEditorEditor">
<SpinnerEditor format="yyyy/MM/dd H:mm:ss" type="1"/>
<SpinnerEditor format="yyyy/MM/dd HH:mm:ss" type="1"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 22]"/>
Expand Down Expand Up @@ -2609,6 +2609,7 @@
</Properties>
<Events>
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="txtExcelSerialFocusLost"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtExcelSerialActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JFormattedTextField" name="txtJavaSerial">
Expand Down Expand Up @@ -2713,7 +2714,7 @@
<Component id="btnStoreTypePKCS12" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="1694" max="32767" attributes="0"/>
<EmptySpace pref="1700" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -2840,7 +2841,7 @@
<Component id="btnCalc" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="jLabel3" pref="1095" max="32767" attributes="0"/>
<Component id="jLabel3" pref="1101" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="671" max="-2" attributes="0"/>
</Group>
Expand Down
Loading

0 comments on commit 48ece8f

Please sign in to comment.