Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme moment to dayjs #1708

Merged
merged 3 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 2279,7 @@ const options = {
return value;
case 1:
// column 2 is a date
return moment(value).format('YYYY-MM-DD');
return dayjs(value).format('YYYY-MM-DD');
case 2:
// column 3 is a formula, write just the result
return value.result;
Expand All @@ -2304,10 2304,10 @@ The CSV parser uses [fast-csv](https://www.npmjs.com/package/fast-csv) to write
The formatterOptions in the options passed to the above write function will be passed to the @fast-csv/format module to write csv data.
Please refer to the fast-csv README.md for details.

Dates are formatted using the npm module [moment](https://www.npmjs.com/package/moment).
If no dateFormat is supplied, moment.ISO_8601 is used.
Dates are formatted using the npm module [dayjs](https://www.npmjs.com/package/dayjs).
If no dateFormat is supplied, dayjs.ISO_8601 is used.
When writing a CSV you can supply the boolean dateUTC as true to have ExcelJS parse the date without automatically
converting the timezone using `moment.utc()`.
converting the timezone using `dayjs.utc()`.

### Streaming I/O[⬆](#contents)<!-- Link generated with jump2header -->

Expand Down
4 changes: 2 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 2196,7 @@ const options = {
return value;
case 1:
// 第2列是日期
return moment(value).format('YYYY-MM-DD');
return dayjs(value).format('YYYY-MM-DD');
case 2:
// 第3列是一个公式,只写结果
return value.result;
Expand All @@ -2219,7 2219,7 @@ const buffer = await workbook.csv.writeBuffer();

CSV 解析器使用 [fast-csv](https://www.npmjs.com/package/fast-csv) 编写 CSV 文件。传递给上述写入函数的选项中的 `formatterOptions` 将传递给 @fast-csv/format 模块以写入 csv 数据。有关详细信息,请参阅 fast-csv README.md。

日期使用 npm 模块 [moment](https://www.npmjs.com/package/moment) 格式化。如果未提供 `dateFormat`,则使用 `moment.ISO_8601`。编写 CSV 时,您可以提供布尔值 `dateUTC` 为 `true`,以使 ExcelJS 解析日期,而无需使用 `moment.utc()` 自动转换时区。
日期使用 npm 模块 [dayjs](https://www.npmjs.com/package/dayjs) 格式化。如果未提供 `dateFormat`,则使用 `dayjs.ISO_8601`。编写 CSV 时,您可以提供布尔值 `dateUTC` 为 `true`,以使 ExcelJS 解析日期,而无需使用 `dayjs.utc()` 自动转换时区。

### 流式 I/O[⬆](#目录)<!-- Link generated with jump2header -->

Expand Down