Skip to content

Commit

Permalink
fix🐛: update rss pubdate for RFC 822
Browse files Browse the repository at this point in the history
  • Loading branch information
isboyjc committed Aug 4, 2024
1 parent a37973b commit 6b42009
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Fetch GitHub Trending

on:
# push:
# branches:
# - main
schedule:
- cron: '0 1 * * *' # UTC 凌晨 1 点
- cron: '0 7 * * *' # UTC 早 7 点
- cron: '0 13 * * *' # UTC 中午 1 点
- cron: '0 19 * * *' # UTC 下午 7 点
push:
branches:
- main
# schedule:
# - cron: '0 1 * * *' # UTC 凌晨 1 点
# - cron: '0 7 * * *' # UTC 早 7 点
# - cron: '0 13 * * *' # UTC 中午 1 点
# - cron: '0 19 * * *' # UTC 下午 7 点

jobs:
build:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
COMMIT_TIME=$(date +'%Y-%m-%d %H:%M:%S')
COMMIT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ)
git commit -m "publish🚀: Fetch GitHub Trending at $COMMIT_TIME"
git push
env:
Expand Down
5 changes: 3 additions & 2 deletions docs/.vitepress/theme/components/CustomHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ref, computed, watch } from 'vue'
import { useData } from 'vitepress'
import { useClipboard } from '@vueuse/core'
import moment from 'moment';
import 'moment-timezone'
import 'moment-duration-format';
import {t, routerPath} from '../locale'
Expand Down Expand Up @@ -93,12 +94,12 @@ const pubDateFormat = computed(() => {
if(!pubDate.value) return ''
moment.locale(lang.value)
const time = moment.utc(pubDate.value, 'MMMM Do YYYY, h:mm:ss a');
const time = moment(pubDate.value).tz('GMT').format('ddd, DD MMM YYYY HH:mm:ss [GMT]');
if (!time.isValid()) {
throw new Error('Invalid time format');
}
const now = moment();
const now = moment().tz('GMT').format('ddd, DD MMM YYYY HH:mm:ss [GMT]');
const duration = moment.duration(now.diff(time));
const seconds = Math.floor(duration.asSeconds());
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"highlight.js": "^11.10.0",
"moment": "^2.30.1",
"moment-duration-format": "^2.3.2",
"moment-timezone": "^0.5.45",
"vue": "^3.4.35",
"xml2js": "^0.6.2"
},
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

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

3 changes: 2 additions & 1 deletion script/save.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const moment = require('moment');
require('moment-timezone')
const path = require('path');
const { writeFileSync, readFileSync, mkdirSync } = require('fs');
const { Builder } = require('xml2js');
const { DATA_BASE_URL, TEMPLATE_BASE_URL } = require('./base')

const dateTime = moment().format('MMMM Do YYYY, h:mm:ss a');
const dateTime = moment().tz('GMT').format('ddd, DD MMM YYYY HH:mm:ss [GMT]');

async function save (data, since = 'daily', language = 'all') {
const filePath = DATA_BASE_URL + since
Expand Down

0 comments on commit 6b42009

Please sign in to comment.