Skip to content

Commit

Permalink
fix: timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Jul 29, 2024
1 parent 9e54568 commit df320bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions .knosys/scripts/command/pmc/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const perPage = 100;

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.tz.setDefault('Asia/Shanghai');

function isDirNameValid(dirName) {
return !dirName.startsWith('.') && !EXCLUDED_MEMBERS.includes(dirName);
Expand Down Expand Up @@ -73,11 +72,11 @@ function resolveTask({ rewardDeadline, studentRewardPatches, readingModifiedTime
}

if (modifiedAt) {
task.modifiedAt = dayjs(modifiedAt).format('YYYY-MM-DD HH:mm:ss ZZ');
task.modifiedAt = dayjs(modifiedAt).tz('Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss ZZ');

console.log(`[KNOSYS_INFO] ${readingModifiedTimeBy} \`members/${memberDirName}/${taskDirName}\` modified at`, task.modifiedAt);

if (studentRewardPatches[memberDirName] && studentRewardPatches[memberDirName][taskDirName] === true || dayjs(task.modifiedAt).isBefore(dayjs(rewardDeadline))) {
if (studentRewardPatches[memberDirName] && studentRewardPatches[memberDirName][taskDirName] === true || dayjs(task.modifiedAt).tz('Asia/Shanghai').isBefore(dayjs(rewardDeadline).tz('Asia/Shanghai'))) {
task.rewardable = true;
}
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const { task: { rewards: taskRewards, rewardDeadline } } = readData(joinPath(pmc

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.tz.setDefault('Asia/Shanghai');

function resolveCompletedEmoji(checked) {
return checked ? '🟢' : '🔴';
Expand Down Expand Up @@ -80,7 +79,7 @@ function generateResult() {
- 未提交报名信息的;
- 完成 task7 的,因其由 Artela 发放;
- 超过有奖截止日期(${dayjs(rewardDeadline).format('YYYY-MM-DD HH:mm:ss')})的。
- 超过有奖截止日期(${dayjs(rewardDeadline).tz('Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss')})的。
更多详见[奖励规则](https://github.com/openbuildxyz/Web3-Frontend-Bootcamp#%E5%A5%96%E5%8A%B1%E6%98%8E%E7%BB%86-%E8%AF%B7%E4%BB%94%E7%BB%86%E9%98%85%E8%AF%BB%E8%A6%81%E6%B1%82)。
Expand Down

0 comments on commit df320bb

Please sign in to comment.