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
6 changes: 6 additions & 0 deletions .changeset/four-peas-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@flatfile/plugin-validate-number': patch
'@flatfile/plugin-validate-date': patch
---

Update READMEs
11 changes: 7 additions & 4 deletions package-lock.json

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

15 changes: 11 additions & 4 deletions validate/date/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ The `outputFormat` parameter specifies the desired output format for the normali
#### `config.includeTime` - `boolean`
The `includeTime` parameter determines whether to include time in the normalized output.

#### `config.locale` - `string` - (optional)
The `locale` parameter specifies the locale to use for date parsing. Currently, only 'en-US' is supported.

## Usage

```bash install
Expand All @@ -45,12 +48,16 @@ export default function (listener: FlatfileListener) {
listener.use(
validateDate({
sheetSlug: 'contacts',
dateFields: ['birthdate', 'registration_date'],
outputFormat: 'MM/DD/YYYY',
dateFields: ['birth_date', 'registration_date'],
outputFormat: 'MM/dd/yyyy',
Comment on lines +51 to +52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update example description to match the code.

The example description still references "birthdate" while the code uses "birth_date". Please update the description to maintain consistency.

-This example sets up the date format normalizer for the "contacts" sheet, normalizing the "birthdate" and "registration_date" fields to the "MM/DD/YYYY" format.
+This example sets up the date format normalizer for the "contacts" sheet, normalizing the "birth_date" and "registration_date" fields to the "MM/dd/yyyy" format.

Committable suggestion was skipped due to low confidence.

includeTime: false
})
)

// ... rest of your Flatfile listener configuration
}
```

## Notes

- The plugin uses the `chrono-node` library for parsing dates, which supports a wide range of date formats.
- If a date cannot be parsed, the plugin will add an error message to the record for that field.
- The `locale` parameter is included in the configuration interface but is not currently used in the implementation. The plugin defaults to using the 'en-US' locale.
Comment on lines +59 to +63

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Address inconsistency with 'locale' parameter

The new "Notes" section provides valuable context about the plugin's functionality. However, there's an inconsistency regarding the 'locale' parameter:

  1. The configuration options include 'locale' as a parameter (lines 24-26).
  2. The notes state that the 'locale' parameter is not currently used in the implementation (line 63).

This inconsistency may confuse users. Consider the following options:

  1. If 'locale' is truly not used, remove it from the configuration options to avoid confusion.
  2. If 'locale' is partially implemented or planned for near-future use, clarify its current status and intended functionality in the documentation.

Please review the implementation to determine the correct approach.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~63-~63: Possible missing comma found.
Context: ... included in the configuration interface but is not currently used in the implementa...

(AI_HYDRA_LEO_MISSING_COMMA)

4 changes: 2 additions & 2 deletions validate/date/src/validate.date.plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ describe('NormalizeDate e2e', () => {

const records = await getRecords(sheetId)

expect(records[0].values['date'].messages.length).toBeGreaterThan(0)
expect(records[0].values['date'].messages[0].message).toContain(
expect(records[0].values['date'].messages?.length).toBeGreaterThan(0)
expect(records[0].values['date'].messages?.[0].message).toContain(
'Unable to parse date string'
)
})
Expand Down
5 changes: 4 additions & 1 deletion validate/number/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ listener.use(
thousandsSeparator: ',',
decimalPoint: '.',
specialTypes: ['even'],
round: true
round: true,
fields: ['numberField']
})
);
```
Expand All @@ -71,6 +72,8 @@ The `validateNumber` accepts a configuration object with the following options:
- `specialTypes`: Array of special number types to validate ('prime', 'even', 'odd')
- `round`: Round the number to the nearest integer
- `truncate`: Truncate the decimal part of the number
- `fields`: Array of field names to apply the validation to
- `sheetSlug`: The slug of the sheet to apply the validation to

## Behavior

Expand Down