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

fix: Improve route "codeforces" time expression readability #11953

Merged
merged 3 commits into from
Feb 26, 2023
Merged

fix: Improve route "codeforces" time expression readability #11953

merged 3 commits into from
Feb 26, 2023

Conversation

Bubbu0129
Copy link
Contributor

完整路由地址 / Example for the proposed route(s)

/codeforces/contests

说明 / Note

The time was previously presented bare and coarse. This PR makes it more human-readable.
Plus, relativeTime was removed, as it only depends on when the endpoint is requested.

@github-actions github-actions bot added Route: v2 v2 route related Auto: Route Test Complete Auto route test has finished on given PR labels Feb 25, 2023
@github-actions
Copy link
Contributor

Successfully generated as following:

http://localhost:1200/codeforces/contests - Success
<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
>
    <channel>
        <title><![CDATA[Codeforces - Contests]]></title>
        <link>https://codeforces.com/contests</link>
        <atom:link href="http://localhost:1200/codeforces/contests" rel="self" type="application/rss+xml" />
        <description><![CDATA[Codeforces - Contests - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        <language>zh-cn</language>
        <lastBuildDate>Sat, 25 Feb 2023 11:29:02 GMT</lastBuildDate>
        <ttl>5</ttl>
        <item>
            <title><![CDATA[Codeforces Round (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round (Div. 2)</p>
<p>开始时间:2023年3月26日星期日 22:35:00</p>
<p>持续时间:0 天, 02 小时, 00 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1798</guid>
            <link>https://codeforces.com/contests/1798</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round (Div. 2)</p>
<p>开始时间:2023年3月17日星期五 22:05:00</p>
<p>持续时间:0 天, 02 小时, 00 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1797</guid>
            <link>https://codeforces.com/contests/1797</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round (Div. 2)</p>
<p>开始时间:2023年3月5日星期日 01:35:00</p>
<p>持续时间:0 天, 02 小时, 00 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1794</guid>
            <link>https://codeforces.com/contests/1794</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round (Div. 3)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round (Div. 3)</p>
<p>开始时间:2023年3月2日星期四 22:35:00</p>
<p>持续时间:0 天, 02 小时, 15 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:ICPC</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1800</guid>
            <link>https://codeforces.com/contests/1800</link>
        </item>
        <item>
            <title><![CDATA[Educational Codeforces Round 144 (Rated for Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Educational Codeforces Round 144 (Rated for Div. 2)</p>
<p>开始时间:2023年2月28日星期二 22:35:00</p>
<p>持续时间:0 天, 02 小时, 00 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:ICPC</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1796</guid>
            <link>https://codeforces.com/contests/1796</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #854 (Div. 1 + Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #854 (Div. 1 + Div. 2)</p>
<p>开始时间:2023年2月27日星期一 22:35:00</p>
<p>持续时间:0 天, 03 小时, 00 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1799</guid>
            <link>https://codeforces.com/contests/1799</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #853 (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #853 (Div. 2)</p>
<p>开始时间:2023年2月25日星期六 22:20:00</p>
<p>持续时间:0 天, 02 小时, 00 分钟, 00 秒 </p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1789</guid>
            <link>https://codeforces.com/contests/1789</link>
        </item>
    </channel>
</rss>

Copy link
Collaborator

@TonyRL TonyRL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use dayjs instead
docs: https://day.js.org/en/

@Bubbu0129
Copy link
Contributor Author

Where? On startTime or durationTime?

@TonyRL
Copy link
Collaborator

TonyRL commented Feb 25, 2023

Both, including sec2str

@Bubbu0129
Copy link
Contributor Author

Legit?

@github-actions
Copy link
Contributor

Successfully generated as following:

http://localhost:1200/codeforces/contests - Success
<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
>
    <channel>
        <title><![CDATA[Codeforces - Contests]]></title>
        <link>https://codeforces.com/contests</link>
        <atom:link href="http://localhost:1200/codeforces/contests" rel="self" type="application/rss+xml" />
        <description><![CDATA[Codeforces - Contests - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        <language>zh-cn</language>
        <lastBuildDate>Sun, 26 Feb 2023 11:50:58 GMT</lastBuildDate>
        <ttl>5</ttl>
        <item>
            <title><![CDATA[Codeforces Round (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round (Div. 2)</p>
<p>开始时间:2023年3月26日 22:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1798</guid>
            <link>https://codeforces.com/contests/1798</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round (Div. 2)</p>
<p>开始时间:2023年3月17日 22:05</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1797</guid>
            <link>https://codeforces.com/contests/1797</link>
        </item>
        <item>
            <title><![CDATA[Nebius Welcome Round (Div. 1 + Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Nebius Welcome Round (Div. 1 + Div. 2)</p>
<p>开始时间:2023年3月12日 22:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1804</guid>
            <link>https://codeforces.com/contests/1804</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #857 (Div. 1)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #857 (Div. 1)</p>
<p>开始时间:2023年3月9日 17:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1801</guid>
            <link>https://codeforces.com/contests/1801</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #857 (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #857 (Div. 2)</p>
<p>开始时间:2023年3月9日 17:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1802</guid>
            <link>https://codeforces.com/contests/1802</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #856 (Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #856 (Div. 2)</p>
<p>开始时间:2023年3月5日 01:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1794</guid>
            <link>https://codeforces.com/contests/1794</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #855 (Div. 3)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #855 (Div. 3)</p>
<p>开始时间:2023年3月2日 22:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:ICPC</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1800</guid>
            <link>https://codeforces.com/contests/1800</link>
        </item>
        <item>
            <title><![CDATA[Educational Codeforces Round 144 (Rated for Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Educational Codeforces Round 144 (Rated for Div. 2)</p>
<p>开始时间:2023年2月28日 22:35</p>
<p>持续时间:2 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:ICPC</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1796</guid>
            <link>https://codeforces.com/contests/1796</link>
        </item>
        <item>
            <title><![CDATA[Codeforces Round #854 by cybercats (Div. 1 + Div. 2)]]></title>
            <description><![CDATA[<p>比赛:Codeforces Round #854 by cybercats (Div. 1 + Div. 2)</p>
<p>开始时间:2023年2月27日 22:35</p>
<p>持续时间:3 小时</p>
<!-- <p>相对时间:</p> -->
<p>比赛类型:CF</p>
]]></description>
            <guid isPermaLink="false">https://codeforces.com/contests/1799</guid>
            <link>https://codeforces.com/contests/1799</link>
        </item>
    </channel>
</rss>

@TonyRL TonyRL merged commit 4698900 into DIYgod:master Feb 26, 2023
nullqwertyuiop pushed a commit to nullqwertyuiop/RSSHub that referenced this pull request Mar 1, 2023
…1953)

* Improve time expression readablity

* Fix lint issues

* use dayjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto: Route Test Complete Auto route test has finished on given PR Route: v2 v2 route related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants