Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 63 additions & 5 deletions examples/parser-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,43 @@ This directory contains WhatsApp chat export examples in various formats for tes
- Japanese media indicators: `<メディアなし>`, `.jpg (ファイル添付)`
- Japanese characters in usernames and messages

### 5. `dash-format-test.txt`
### 5. `asian-ampm-format-test.txt`
- **Date Format**: `YYYY/MM/DD, HH:MM am/pm`
- **Example**: `2024/12/01, 10:04 pm`
- **Locale**: Year-first formats with 12-hour clock
- **Features Tested**:
- Asian year-first date format with AM/PM
- Lowercase AM/PM (`am`, `pm`)
- Real-world export style from issue reports

### 6. `european-ampm-format-test.txt`
- **Date Format**: `DD/MM/YYYY, H:MM AM/PM`
- **Example**: `23/06/2018, 1:55 p.m.`
- **Locale**: Day-first formats with 12-hour clock
- **Features Tested**:
- Day-first date with AM/PM
- AM/PM variants: `p.m.`, `p. m.`, uppercase/lowercase
- Compatibility with parser normalization of AM/PM tokens

### 7. `dot-time-klo-format-test.txt`
- **Date Format**: `DD.MM.YYYY klo HH.MM.SS` and `DD.MM.YY HH.MM.SS:`
- **Example**: `13.6.2018 klo 21.25.15`
- **Locale**: Finnish and dot-time variants
- **Features Tested**:
- Finnish marker `klo`
- Time using dot separator (`HH.MM` and `HH.MM.SS`)
- Separator after timestamp using `:`

### 8. `bracketed-year-first-test.txt`
- **Date Format**: `[YYYY/MM/DD, HH:MM:SS]` and `[YYYY/MM/DD H:MM:SS AM/PM]`
- **Example**: `[2018/06/13, 21:25:15]`
- **Locale**: Year-first bracketed variants
- **Features Tested**:
- Bracketed year-first format
- 24-hour and 12-hour variants
- AM/PM normalization inside brackets

### 9. `dash-format-test.txt`
- **Date Format**: `DD-MM-YYYY, HH:MM`
- **Example**: `10-12-2024, 14:30`
- **Locale**: Alternative European format
Expand Down Expand Up @@ -76,25 +112,47 @@ The parser supports the following date patterns:
- Example: `2024/12/10, 14:30`
- Year-first format (Japan, China, Korea)

7. **Bracketed Format**: `[DD/MM/YY, HH:MM:SS]`
7. **Asian Format (12h)**: `YYYY/MM/DD, HH:MM AM/PM`
- Example: `2024/12/01, 10:04 pm`
- Year-first format with 12-hour clock
- Supports uppercase and lowercase AM/PM

8. **European/Brazilian Format (12h)**: `DD/MM/YY, H:MM AM/PM`
- Example: `23/06/2018, 1:55 p.m.`
- Day-first format with 12-hour clock
- Supports `AM`, `PM`, `a.m.`, `p.m.`, and `p. m.` variants

9. **Bracketed Format**: `[DD/MM/YY, HH:MM:SS]`
- Example: `[10/12/24, 14:30:45]`
- Some older WhatsApp versions

8. **iOS Bracketed Format (12h)**: `[DD/MM/YYYY, HH:MM:SS AM/PM]`
10. **iOS Bracketed Format (12h)**: `[DD/MM/YYYY, HH:MM:SS AM/PM]`
- Example: `[13/11/2025, 12:25:55 PM]`
- iOS WhatsApp exports
- Uses 12-hour format with AM/PM
- May contain Unicode whitespace (U+202F) before AM/PM
- File typically named `_chat.txt` (with underscore prefix)

11. **Bracketed Year-First Format**: `[YYYY/MM/DD, HH:MM:SS]`
- Example: `[2018/06/13, 21:25:15]`
- Supports both 24-hour and AM/PM variants

12. **Dot-Time + Finnish `klo`**: `DD.MM.YYYY klo HH.MM.SS`
- Example: `13.6.2018 klo 21.25.15`
- Dot-separated time normalized for parsing

## Test Files

### 1. `german-format-test.txt` (see above)
### 2. `spanish-format-test.txt` (see above)
### 3. `french-format-test.txt` (see above)
### 4. `asian-format-test.txt` (see above)
### 5. `dash-format-test.txt` (see above)
### 6. `ios-format-test.txt`
### 5. `asian-ampm-format-test.txt` (see above)
### 6. `european-ampm-format-test.txt` (see above)
### 7. `dot-time-klo-format-test.txt` (see above)
### 8. `bracketed-year-first-test.txt` (see above)
### 9. `dash-format-test.txt` (see above)
### 10. `ios-format-test.txt`
- **Date Format**: `[DD/MM/YYYY, HH:MM:SS AM/PM]`
- **Example**: `[13/11/2025, 12:25:55 PM]`
- **Locale**: iOS (all locales)
Expand Down
5 changes: 5 additions & 0 deletions examples/parser-tests/asian-ampm-format-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2024/12/01, 10:04 pm - Alice: Messages and calls are end-to-end encrypted. Only people in this chat can read, listen to, or share them. Learn more.
2024/12/01, 10:05 pm - Alice: Hello there
2024/12/01, 10:06 pm - Bob: Hi!
2024/12/01, 10:07 pm - Alice: <Media omitted>
2024/12/01, 10:08 pm - Bob: Nice
3 changes: 3 additions & 0 deletions examples/parser-tests/bracketed-year-first-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[2018/06/13, 21:25:15] Ana: mensagem com colchetes
[2018/06/13 1:55:00 p. m.] Bruno: ampm com espaços
[2018/06/13, 01:56:00 AM] Ana: uppercase também funciona
3 changes: 3 additions & 0 deletions examples/parser-tests/dot-time-klo-format-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
13.6.2018 klo 21.25.15 - Mika: tämä on testi
13.06.18 21.25.15: Laura: tämä on toinen testi
13.06.2018, 21.25 - Mika: ilman sekunteja
4 changes: 4 additions & 0 deletions examples/parser-tests/european-ampm-format-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
23/06/2018, 1:55 p.m. - Loris: one
23/06/2018, 1:56 p. m. - Luke: two
23/06/2018, 1:57 PM - Loris: three
23/06/2018, 1:58 am - Luke: four
42 changes: 12 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/lib/components/MediaGallery.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,13 @@ onDestroy(() => {
<Icon name="close" size="md" />
</IconButton>
</div>

<DropdownSearch
bind:value={participantSearchQuery}
bind:ref={participantSearchInputRef}
placeholder={m.media_gallery_participant_search_placeholder()}
/>

<div class="max-h-80 overflow-y-auto py-2">
{#each filteredMediaParticipants as participant (participant)}
<ListItemButton
Expand Down Expand Up @@ -811,7 +811,7 @@ onDestroy(() => {
{/if}
·
{#if lightboxItem.messageTimestamp}
{new Date(lightboxItem.messageTimestamp).toLocaleString()}
{new Date(lightboxItem.messageTimestamp).toLocaleString(getLocale())}
{:else}
{m.media_gallery_unknown_date()}
{/if}
Expand Down
Loading