diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-03-26 12:30:43 +0100 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-03-26 12:30:43 +0100 |
commit | 7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3 (patch) | |
tree | 2d135723d1b9f1a0efde590377975b5282d1327f /src/org/uic/barcode/ticket/api | |
parent | temp (diff) | |
download | UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.tar UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.tar.gz UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.tar.bz2 UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.tar.lz UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.tar.xz UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.tar.zst UIC-barcode-7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3.zip |
Diffstat (limited to 'src/org/uic/barcode/ticket/api')
-rw-r--r-- | src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java | 16 | ||||
-rw-r--r-- | src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java | 20 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java index d0c5710..d67f857 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java @@ -21,7 +21,6 @@ package org.uic.barcode.ticket.api.asn.omv1; import java.util.Calendar;
import java.util.Date;
-import java.util.TimeZone;
import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
@@ -252,7 +251,6 @@ public class CustomerCardData extends Object { untilCal.setTime(untilDate);
int untildays = untilCal.get(Calendar.DAY_OF_YEAR);
-
int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR);
this.validUntilYear = new Long( yearDiff);
@@ -262,14 +260,15 @@ public class CustomerCardData extends Object { public Date getValidFromDate (){
- if (this.validFromYear == null || this.validFromYear == 0) return null;
+ if (this.validFromYear == null || this.validFromDay == null) return null;
Calendar cal = Calendar.getInstance();
cal.clear();
- cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ //cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.set(Calendar.YEAR, this.validFromYear.intValue());
cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue());
-
+ cal.set(Calendar.MINUTE,0);
+ cal.set(Calendar.HOUR_OF_DAY,0);
return cal.getTime();
}
@@ -277,17 +276,18 @@ public class CustomerCardData extends Object { public Date getValidUntilDate (){
- if (this.validUntilYear == null || this.validUntilYear == 0) return null;
+ if (this.validUntilYear == null || this.validUntilDay == null) return null;
Calendar cal = Calendar.getInstance();
cal.clear();
- cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ //cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.set(Calendar.YEAR, this.validFromYear.intValue());
if (this.validUntilYear != null) {
cal.add(Calendar.YEAR, this.validUntilYear.intValue());
}
cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue());
-
+ cal.set(Calendar.MINUTE,59);
+ cal.set(Calendar.HOUR_OF_DAY,23);
return cal.getTime();
}
diff --git a/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java index daa6a0e..315774e 100644 --- a/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java +++ b/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java @@ -21,7 +21,7 @@ import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder; /**
- * The Class FipTimeZoneTestV1.
+ * The Class CustomerCardTestV1.
*
*
*
@@ -141,9 +141,9 @@ public class CustomerCardTimeZoneTestV1 { assert(validFromDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
assert(validFromDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validUntilDate1.equals("Thu Mar 24 00:00:00 CET 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 00:00:00 CET 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 00:00:00 CET 2022" ));
+ assert(validUntilDate1.equals("Thu Mar 24 23:59:00 CET 2022" ));
+ assert(validUntilDate2.equals("Thu Mar 24 23:59:00 CET 2022" ));
+ assert(validUntilDate3.equals("Thu Mar 24 23:59:00 CET 2022" ));
}
@@ -182,9 +182,9 @@ public class CustomerCardTimeZoneTestV1 { assert(validFromDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
assert(validFromDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validUntilDate1.equals("Thu Mar 24 00:00:00 CET 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 00:00:00 CET 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 00:00:00 CET 2022" ));
+ assert(validUntilDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntilDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntilDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
}
@@ -222,9 +222,9 @@ public class CustomerCardTimeZoneTestV1 { assert(validFromDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
assert(validFromDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validUntilDate1.equals("Thu Mar 24 00:00:00 GMT 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 00:00:00 GMT 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 00:00:00 GMT 2022" ));
+ assert(validUntilDate1.equals("Thu Mar 24 23:59:00 GMT 2022" ));
+ assert(validUntilDate2.equals("Thu Mar 24 23:59:00 GMT 2022" ));
+ assert(validUntilDate3.equals("Thu Mar 24 23:59:00 GMT 2022" ));
}
|