Commit c3a75e5
committed
date: add locale-aware calendar support for era years
Implements era year calculation for Buddhist, Persian Solar Hijri, and Ethiopian calendars based on locale detection. The %Y format specifier now outputs era-appropriate years while maintaining Gregorian calendar for ISO-8601 and RFC-3339 formats for interoperability.
- Add CalendarType enum with Buddhist (+543), Persian (-621/-622), Ethiopian (-7/-8) year offsets
- Implement get_era_year() with input validation and efficient calendar conversion
- Extend ICU formatting to handle %Y era year replacement with collision-safe NULL-byte placeholders
- Add comprehensive test coverage for th_TH.UTF-8, fa_IR.UTF-8, and am_ET.UTF-8 locales
- Enable i18n-datetime feature by default with icu_locale dependency
- Fix calendar conversion logic for proper year transitions at Nowruz and Ethiopian New Year
- Remove unused helper functions for cleaner codebase1 parent 8219153 commit c3a75e5
File tree
7 files changed
+422
-17
lines changed- .vscode/cspell.dictionaries
- fuzz
- src
- uucore/src/lib/features/i18n
- uu/date
- src
- tests/by-util
7 files changed
+422
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
618 | 620 | | |
619 | 621 | | |
620 | 622 | | |
621 | | - | |
622 | | - | |
623 | | - | |
| 623 | + | |
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
628 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
629 | 631 | | |
630 | 632 | | |
631 | 633 | | |
| |||
665 | 667 | | |
666 | 668 | | |
667 | 669 | | |
668 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
669 | 686 | | |
670 | 687 | | |
671 | | - | |
| 688 | + | |
672 | 689 | | |
673 | 690 | | |
674 | | - | |
| 691 | + | |
675 | 692 | | |
676 | 693 | | |
677 | | - | |
| 694 | + | |
678 | 695 | | |
679 | 696 | | |
680 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
681 | 701 | | |
682 | 702 | | |
683 | 703 | | |
684 | 704 | | |
685 | 705 | | |
686 | | - | |
| 706 | + | |
687 | 707 | | |
688 | 708 | | |
689 | | - | |
| 709 | + | |
690 | 710 | | |
691 | 711 | | |
692 | | - | |
| 712 | + | |
693 | 713 | | |
694 | 714 | | |
695 | | - | |
| 715 | + | |
696 | 716 | | |
697 | 717 | | |
698 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
699 | 722 | | |
700 | 723 | | |
701 | 724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
119 | 209 | | |
120 | 210 | | |
121 | 211 | | |
| |||
128 | 218 | | |
129 | 219 | | |
130 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
131 | 264 | | |
0 commit comments