Commit 8a212c7
Support GS1-128 date AIs with a four-digit year
AI 7250 (DOB, N8 YYYYMMDD) and 7251 (DOB TIME, N12 YYYYMMDDhhmm) use a
four-digit year, but _encode_date() and _decode_date() only handled
two-digit-year formats. Encoding raised "unsupported format: N8" and
decoding raised a bare ValueError: N8 was parsed with '%y%m%d%H' and N12
was mistaken for two YYMMDD dates.
Handle N8 and N12 explicitly in both directions and stop treating N12 as
a pair of dates (only N6[+N6] / N6..12 encode two dates).
Closes #4981 parent 7662137 commit 8a212c7
2 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
| |||
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
188 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
189 | 203 | | |
190 | 204 | | |
191 | 205 | | |
| |||
196 | 210 | | |
197 | 211 | | |
198 | 212 | | |
199 | | - | |
| 213 | + | |
200 | 214 | | |
201 | 215 | | |
202 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| |||
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
157 | 165 | | |
158 | 166 | | |
159 | 167 | | |
| |||
0 commit comments