Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
youniaogu committed Dec 15, 2023
1 parent 517dded commit d23c162
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ import { CacheManager } from '@georstat/react-native-image-cache';
import { AppRegistry } from 'react-native';
import { Dirs } from 'react-native-file-access';
import { name } from './app.json';
import dayjs from 'dayjs';
import App from '~/App';
import * as packageJson from './package.json';

require('dayjs/locale/zh-cn');

// https://day.js.org/docs/zh-CN/plugin/custom-parse-format
dayjs.extend(require('dayjs/plugin/customParseFormat'));
// https://day.js.org/docs/zh-CN/i18n/changing-locale
dayjs.locale('zh-cn');

process.env.NAME = name;
process.env.VERSION = 'v' + packageJson.version;
process.env.PUBLISH_TIME = packageJson.publishTime;
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/bzm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const discoveryOptions = [
];

const PATTERN_MANGA_ID = /\/comic\/([^_]+)/;
const PATTERN_HOUR_TIME = /([0-9]+) /;
const PATTERN_FULL_TIME = /([0-9]{4}[0-9]{2}[0-9]{2})/;
const PATTERN_SLOT = /section_slot=([0-9]*)&chapter_slot=([0-9]*)/;

Expand Down Expand Up @@ -262,6 +263,11 @@ class BaoziManga extends Base {
if (PATTERN_FULL_TIME.test(updateTimeLabel)) {
updateTime = (updateTimeLabel.match(PATTERN_FULL_TIME) || [])[1];
updateTime = dayjs(updateTime, 'YYYY年MM月DD日').format('YYYY-MM-DD');
} else if (PATTERN_HOUR_TIME.test(updateTimeLabel)) {
updateTime = (updateTimeLabel.match(PATTERN_HOUR_TIME) || [])[1];
updateTime = dayjs()
.subtract(Number(updateTime) || 0, 'h')
.format('YYYY-MM-DD');
} else if (updateTimeLabel.includes('今天 更新')) {
updateTime = dayjs().format('YYYY-MM-DD');
}
Expand Down

0 comments on commit d23c162

Please sign in to comment.