Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad4807e

Browse files
authored
OBPIH-7474 fix. change product export dates to existing pattern (#5561)
1 parent951b623 commitad4807e

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

‎src/main/groovy/org/pih/warehouse/core/date/TemporalAccessorDateFormatter.groovy‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ class TemporalAccessorDateFormatter<T extends TemporalAccessor> extends Temporal
2626
}
2727

2828
DateTimeFormattergetCsvFormatter() {
29+
// TODO: Preserve the existing display format until we can start the date refactor (scheduled for 0.9.7).
30+
// Once we decide on a format/style to use for CSVs, update this line.
31+
returnDateTimeFormatter.ofPattern('dd/MMM/yyyy')
32+
2933
// We format our CSV exports using ISO pattern (regardless of locale) because we want to ensure that if
3034
// the same CSV is later imported, it won't fail on date format errors. We could export to a locale-specific
3135
// pattern but we'd need to verify that each of those patterns can be handled by our data binders. For now,
3236
// we stick with ISO pattern because it's a universally accepted date format and is guaranteed to work.
33-
returnDateTimeFormatter.ISO_DATE
37+
//return DateTimeFormatter.ISO_DATE
3438
}
3539
}

‎src/main/groovy/org/pih/warehouse/core/date/TemporalAccessorDateTimeFormatter.groovy‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import java.time.ZoneId
44
importjava.time.format.DateTimeFormatter
55
importjava.time.temporal.TemporalAccessor
66

7-
importorg.pih.warehouse.DateUtil
8-
97
/**
108
* A formatter that converts TemporalAccessor objects that have a date + time component to Strings.
119
*/
@@ -36,11 +34,15 @@ class TemporalAccessorDateTimeFormatter<T extends TemporalAccessor> extends Temp
3634
}
3735

3836
DateTimeFormattergetCsvFormatter() {
37+
// TODO: Preserve the existing display format until we can start the date refactor (scheduled for 0.9.7).
38+
// Once we decide on a format/style to use for CSVs, update this line.
39+
returnDateTimeFormatter.ofPattern('dd/MMM/yyyy HH:mm:ss')
40+
3941
// We format our CSV exports using ISO pattern (regardless of locale) because we want to ensure that if
4042
// the same CSV is later imported, it won't fail on date format errors. We could export to a locale-specific
4143
// pattern but we'd need to verify that each of those patterns can be handled by our data binders. For now,
4244
// we stick with ISO pattern because it's a universally accepted date format and is guaranteed to work.
43-
returnDateTimeFormatter.ISO_OFFSET_DATE_TIME
45+
//return DateTimeFormatter.ISO_OFFSET_DATE_TIME
4446
}
4547

4648
@Override

‎src/test/groovy/unit/org/pih/warehouse/core/date/TemporalAccessorDateFormatterSpec.groovy‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class TemporalAccessorDateFormatterSpec extends Specification {
5656
locale | format|| expectedResult | scenario
5757
Locale.ENGLISH |DateDisplayFormat.GSP||'01/Jan/2000' |'GSP format localization in english'
5858
Locale.ITALIAN |DateDisplayFormat.GSP||'gen-01-2000' |'GSP format localization in non-english'
59-
Locale.ENGLISH |DateDisplayFormat.CSV||'2000-01-01'|'CSV formatshould use ISO strings (english)'
60-
Locale.ITALIAN |DateDisplayFormat.CSV||'2000-01-01'|'CSV formatshould use ISO strings (non-english)'
59+
Locale.ENGLISH |DateDisplayFormat.CSV||'01/Jan/2000' |'CSV formatlocalization inenglish'
60+
Locale.ITALIAN |DateDisplayFormat.CSV||'01/gen/2000' |'CSV formatlocalization innon-english'
6161
Locale.ENGLISH |DateDisplayFormat.JSON||'2000-01-01' |'JSON format should use ISO strings (english)'
6262
Locale.ITALIAN |DateDisplayFormat.JSON||'2000-01-01' |'JSON format should use ISO strings (non-english)'
6363
}

‎src/test/groovy/unit/org/pih/warehouse/core/date/TemporalAccessorDateTimeFormatterSpec.groovy‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ class TemporalAccessorDateTimeFormatterSpec extends Specification {
6060
locale | format | offset|| expectedResult | scenario
6161
Locale.ENGLISH |DateDisplayFormat.GSP |'Z'||'01/Jan/2000 00:00' |'GSP format localization in english UTC'
6262
Locale.ITALIAN |DateDisplayFormat.GSP |'Z'||'gen-01-2000 00:00' |'GSP format localization in non-english UTC'
63-
Locale.ENGLISH |DateDisplayFormat.CSV |'Z'||'2000-01-01T00:00:00Z' |'CSV formatuses ISO strings (english) UTC'
64-
Locale.ITALIAN |DateDisplayFormat.CSV |'Z'||'2000-01-01T00:00:00Z' |'CSV formatuses ISO strings (non-english) UTC'
63+
Locale.ENGLISH |DateDisplayFormat.CSV |'Z'||'01/Jan/2000 00:00:00' |'CSV formatlocalization (english) UTC'
64+
Locale.ITALIAN |DateDisplayFormat.CSV |'Z'||'01/gen/2000 00:00:00' |'CSV formatlocalization (non-english) UTC'
6565
Locale.ENGLISH |DateDisplayFormat.JSON |'Z'||'2000-01-01T00:00:00Z' |'JSON format uses ISO strings (english) UTC'
6666
Locale.ITALIAN |DateDisplayFormat.JSON |'Z'||'2000-01-01T00:00:00Z' |'JSON format uses ISO strings (non-english) UTC'
6767
Locale.ENGLISH |DateDisplayFormat.GSP |'+01:00'||'01/Jan/2000 01:00' |'GSP format localization in english UTC+1'
6868
Locale.ITALIAN |DateDisplayFormat.GSP |'+01:00'||'gen-01-2000 01:00' |'GSP format localization in non-english UTC+1'
69-
Locale.ENGLISH |DateDisplayFormat.CSV |'+01:00'||'2000-01-01T01:00:00+01:00'|'CSV formatuses ISO strings (english) UTC+1'
70-
Locale.ITALIAN |DateDisplayFormat.CSV |'+01:00'||'2000-01-01T01:00:00+01:00'|'CSV formatuses ISO strings (non-english) UTC+1'
69+
Locale.ENGLISH |DateDisplayFormat.CSV |'+01:00'||'01/Jan/2000 01:00:00'|'CSV formatlocalization (english) UTC+1'
70+
Locale.ITALIAN |DateDisplayFormat.CSV |'+01:00'||'01/gen/2000 01:00:00'|'CSV formatlocalization (non-english) UTC+1'
7171
Locale.ENGLISH |DateDisplayFormat.JSON |'+01:00'||'2000-01-01T01:00:00+01:00' |'JSON format uses ISO strings (english) UTC+1'
7272
Locale.ITALIAN |DateDisplayFormat.JSON |'+01:00'||'2000-01-01T01:00:00+01:00' |'JSON format uses ISO strings (non-english) UTC+1'
7373
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp