Skip to content

Commit

Permalink
feat(module): change week date format to yyyy/mm/dd
Browse files Browse the repository at this point in the history
BREAKING CHANGES: the week date format for enhanced parsing was changed to yyyy/mm/dd
  • Loading branch information
rhahao authored Sep 27, 2023
1 parent d4105fb commit 2bf8f5e
Show file tree
Hide file tree
Showing 23 changed files with 338 additions and 333 deletions.
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand All @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
sws2apps.notification@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { loadEPUB } from 'jw-epub-parser';
// node
import { loadEPUB } from 'jw-epub-parser/dist/node/index.js';

// sample usage
const epubJW = await loadEPUB('/path/to/file.epub');

const epubJW = await loadEPUB({ url: epubUrl });
Expand All @@ -50,7 +51,7 @@ By calling the `loadEPUB` function, it will return an array of objects with the

| Name | Type | Description |
| ------------------------ | :---------------: | ------------------------------------------------------------------------------------------------------------------------------- |
| mwb_week_date | string | Week date. For enhanced parsing, it is formatted as `mm/dd/yyyy` |
| mwb_week_date | string | Week date. For enhanced parsing, it is formatted as `yyyy/mm/dd` |
| mwb_week_date_locale\* | string | Week date |
| mwb_weekly_bible_reading | string | Weekly Bible Reading |
| mwb_song_first | integer | First song |
Expand Down Expand Up @@ -84,7 +85,7 @@ By calling the `loadEPUB` function, it will return an array of objects with the

| Name | Type | Description |
| ----------------------- | :-----: | ---------------------------------------------------------------- |
| w_study_date | string | Week date. For enhanced parsing, it is formatted as `mm/dd/yyyy` |
| w_study_date | string | Week date. For enhanced parsing, it is formatted as `yyyy/mm/dd` |
| w_study_date_locale\* | string | Week date |
| w_study_title | string | Watchtower Study Article Title |
| w_study_opening_song | integer | Opening Song for the Watchtower Study |
Expand Down Expand Up @@ -119,7 +120,7 @@ Here are how the results of this module look like:
```js
[
{
mwb_week_date: '09/04/2023',
mwb_week_date: '2023/09/04',
mwb_week_date_locale: 'September 4-10',
mwb_weekly_bible_reading: 'ESTHER 1-2',
mwb_song_first: 137,
Expand Down Expand Up @@ -157,7 +158,7 @@ Here are how the results of this module look like:
```js
[
{
w_study_date: '11/06/2023',
w_study_date: '2023/11/06',
w_study_date_locale: 'Study Article 37: November 6-12, 2023',
w_study_title: 'Rely on Jehovah, as Samson Did',
w_study_opening_song: 30,
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

You can report a vulnerability by contacting us via email at [email protected]. We will try to do our best to respond you and handle the matter as soon as possible.
You can report a vulnerability by contacting us via email at sws2apps.notification@gmail.com. We will try to do our best to respond you and handle the matter as soon as possible.
2 changes: 1 addition & 1 deletion TRANSLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To enhance parsing for a language, make sure first that EPUB is available for th

All translated and approved content will be pushed to this repo automatically. You don't need to create any PRs with translation.

Original source can be found in [/locales/en](https://github.com/sws2apps/jw-epub-parser/tree/main/src/locales/en). If you find any problem with original source, please create a PR with changes directly to `/locales/en`. Crowdin automatically pull all updates within 3 hours.
Original source can be found in [/locales/en](https://github.com/sws2apps/jw-epub-parser/tree/main/src/locales/en). If you find any problem with original source, please create a PR with changes directly to `/locales/en`. Crowdin automatically pull all updates within 1 hour.

### I can't find my language on Crowdin

Expand Down
6 changes: 3 additions & 3 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { fetchData } from './sample.js';

const runLiveCommand = async () => {
const languageIndex = process.argv.indexOf('--language');
const languageIndex = process.argv.indexOf('language');
if (languageIndex === -1) {
console.error('language missing from arguments');
return;
}

const issueIndex = process.argv.indexOf('--issue');
const pubIndex = process.argv.indexOf('--pub');
const issueIndex = process.argv.indexOf('issue');
const pubIndex = process.argv.indexOf('pub');

if (issueIndex >= 0 && pubIndex === -1) {
console.error('issue date was provided but pub type is missing');
Expand Down
10 changes: 7 additions & 3 deletions release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ module.exports = {
'@semantic-release/git',
{
assets: ['package.json', 'CHANGELOG.md'],
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
[
Expand All @@ -34,6 +33,11 @@ module.exports = {
prepareCmd: 'npm run build',
},
],
'@semantic-release/github',
[
'@semantic-release/github',
{
discussionCategoryName: 'Announcements',
},
],
],
};
36 changes: 18 additions & 18 deletions src/common/enhanced_parse_utils.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import dateFormat from 'dateformat';
import {
extractAYFAssignment,
extractCBSSource,
extractLCAssignment,
extractMonthName,
extractTGWBibleReading,
extractTGWTalk,
extractWTStudyDate,
extractAYFAssignment,
extractCBSSource,
extractLCAssignment,
extractMonthName,
extractTGWBibleReading,
extractTGWTalk,
extractWTStudyDate,
} from './parsing_rules.js';

export const getMWBWeekDateEnhanced = (weekDate, mwbYear, lang) => {
const { varDay, monthIndex } = extractMonthName(weekDate, lang);
const schedDate = new Date(mwbYear, monthIndex, varDay);
const { varDay, monthIndex } = extractMonthName(weekDate, lang);
const schedDate = new Date(mwbYear, monthIndex, varDay);

return dateFormat(schedDate, 'mm/dd/yyyy');
return dateFormat(schedDate, 'yyyy/mm/dd');
};

export const getMWBTGWTalkEnhanced = (src, lang) => {
return extractTGWTalk(src, lang);
return extractTGWTalk(src, lang);
};

export const getMWBTGWBibleReadingEnhanced = (src, lang) => {
return extractTGWBibleReading(src, lang);
return extractTGWBibleReading(src, lang);
};

export const getMWBAYFEnhanced = (src, lang) => {
return extractAYFAssignment(src, lang);
return extractAYFAssignment(src, lang);
};

export const getMWBLCEnhanced = (src, lang) => {
return extractLCAssignment(src, lang);
return extractLCAssignment(src, lang);
};

export const getMWBCBSEnhanced = (src, lang) => {
return extractCBSSource(src, lang);
return extractCBSSource(src, lang);
};

export const getWTStudyDateEnhanced = (src, lang) => {
const { varDay, monthIndex, varYear } = extractWTStudyDate(src, lang);
const schedDate = new Date(varYear, monthIndex, varDay);
return dateFormat(schedDate, 'mm/dd/yyyy');
const { varDay, monthIndex, varYear } = extractWTStudyDate(src, lang);
const schedDate = new Date(varYear, monthIndex, varDay);
return dateFormat(schedDate, 'yyyy/mm/dd');
};
18 changes: 9 additions & 9 deletions test/fixtures/mwb_E_202309.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default [
{
mwb_week_date: '09/04/2023',
mwb_week_date: '2023/09/04',
mwb_week_date_locale: 'September 4-10',
mwb_weekly_bible_reading: 'ESTHER 1-2',
mwb_song_first: 137,
Expand Down Expand Up @@ -30,7 +30,7 @@ export default [
mwb_song_conclude: 101,
},
{
mwb_week_date: '09/11/2023',
mwb_week_date: '2023/09/11',
mwb_week_date_locale: 'September 11-17',
mwb_weekly_bible_reading: 'ESTHER 3-5',
mwb_song_first: 85,
Expand Down Expand Up @@ -60,7 +60,7 @@ export default [
mwb_song_conclude: 125,
},
{
mwb_week_date: '09/18/2023',
mwb_week_date: '2023/09/18',
mwb_week_date_locale: 'September 18-24',
mwb_weekly_bible_reading: 'ESTHER 6-8',
mwb_song_first: 115,
Expand All @@ -86,7 +86,7 @@ export default [
mwb_song_conclude: 124,
},
{
mwb_week_date: '09/25/2023',
mwb_week_date: '2023/09/25',
mwb_week_date_locale: 'September 25–October 1',
mwb_weekly_bible_reading: 'ESTHER 9-10',
mwb_song_first: 102,
Expand All @@ -112,7 +112,7 @@ export default [
mwb_song_conclude: 55,
},
{
mwb_week_date: '10/02/2023',
mwb_week_date: '2023/10/02',
mwb_week_date_locale: 'October 2-8',
mwb_weekly_bible_reading: 'JOB 1-3',
mwb_song_first: 141,
Expand Down Expand Up @@ -143,7 +143,7 @@ export default [
mwb_song_conclude: 129,
},
{
mwb_week_date: '10/09/2023',
mwb_week_date: '2023/10/09',
mwb_week_date_locale: 'October 9-15',
mwb_weekly_bible_reading: 'JOB 4-5',
mwb_song_first: 121,
Expand All @@ -168,7 +168,7 @@ export default [
mwb_song_conclude: 38,
},
{
mwb_week_date: '10/16/2023',
mwb_week_date: '2023/10/16',
mwb_week_date_locale: 'October 16-22',
mwb_weekly_bible_reading: 'JOB 6-7',
mwb_song_first: 33,
Expand All @@ -195,7 +195,7 @@ export default [
mwb_song_conclude: 143,
},
{
mwb_week_date: '10/23/2023',
mwb_week_date: '2023/10/23',
mwb_week_date_locale: 'October 23-29',
mwb_weekly_bible_reading: 'JOB 8-10',
mwb_song_first: 107,
Expand Down Expand Up @@ -224,7 +224,7 @@ export default [
mwb_song_conclude: 64,
},
{
mwb_week_date: '10/30/2023',
mwb_week_date: '2023/10/30',
mwb_week_date_locale: 'October 30–November 5',
mwb_weekly_bible_reading: 'JOB 11-12',
mwb_song_first: 87,
Expand Down
18 changes: 9 additions & 9 deletions test/fixtures/mwb_F_202309.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default [
{
mwb_week_date: '09/04/2023',
mwb_week_date: '2023/09/04',
mwb_week_date_locale: '4-10 septembre',
mwb_weekly_bible_reading: 'ESTHER 1-2',
mwb_song_first: 137,
Expand Down Expand Up @@ -31,7 +31,7 @@ export default [
mwb_song_conclude: 101,
},
{
mwb_week_date: '09/11/2023',
mwb_week_date: '2023/09/11',
mwb_week_date_locale: '11-17 septembre',
mwb_weekly_bible_reading: 'ESTHER 3-5',
mwb_song_first: 85,
Expand Down Expand Up @@ -61,7 +61,7 @@ export default [
mwb_song_conclude: 125,
},
{
mwb_week_date: '09/18/2023',
mwb_week_date: '2023/09/18',
mwb_week_date_locale: '18-24 septembre',
mwb_weekly_bible_reading: 'ESTHER 6-8',
mwb_song_first: 115,
Expand All @@ -88,7 +88,7 @@ export default [
mwb_song_conclude: 124,
},
{
mwb_week_date: '09/25/2023',
mwb_week_date: '2023/09/25',
mwb_week_date_locale: '25 septembre – 1er octobre',
mwb_weekly_bible_reading: 'ESTHER 9-10',
mwb_song_first: 102,
Expand All @@ -114,7 +114,7 @@ export default [
mwb_song_conclude: 55,
},
{
mwb_week_date: '10/02/2023',
mwb_week_date: '2023/10/02',
mwb_week_date_locale: '2-8 octobre',
mwb_weekly_bible_reading: 'JOB 1-3',
mwb_song_first: 141,
Expand Down Expand Up @@ -146,7 +146,7 @@ export default [
mwb_song_conclude: 129,
},
{
mwb_week_date: '10/09/2023',
mwb_week_date: '2023/10/09',
mwb_week_date_locale: '9-15 octobre',
mwb_weekly_bible_reading: 'JOB 4-5',
mwb_song_first: 121,
Expand All @@ -171,7 +171,7 @@ export default [
mwb_song_conclude: 38,
},
{
mwb_week_date: '10/16/2023',
mwb_week_date: '2023/10/16',
mwb_week_date_locale: '16-22 octobre',
mwb_weekly_bible_reading: 'JOB 6-7',
mwb_song_first: 33,
Expand All @@ -198,7 +198,7 @@ export default [
mwb_song_conclude: 143,
},
{
mwb_week_date: '10/23/2023',
mwb_week_date: '2023/10/23',
mwb_week_date_locale: '23-29 octobre',
mwb_weekly_bible_reading: 'JOB 8-10',
mwb_song_first: 107,
Expand Down Expand Up @@ -227,7 +227,7 @@ export default [
mwb_song_conclude: 64,
},
{
mwb_week_date: '10/30/2023',
mwb_week_date: '2023/10/30',
mwb_week_date_locale: '30 octobre – 5 novembre',
mwb_weekly_bible_reading: 'JOB 11-12',
mwb_song_first: 87,
Expand Down
Loading

0 comments on commit 2bf8f5e

Please sign in to comment.