An API endpoint that returns a number of week since an arbitrary date. It also support a response format that is used by Shields.io.
To include this in your Blackboard course, in the content editor, click "Edit source" then paste in the following HTML fragment.
<a href="https://github.com/OU-CS3560/relative-week" target="_blank" rel="nofollow"><img src="https://img.shields.io/endpoint?url=https://relative-week-ksraqzy7na-uk.a.run.app?genesisDate=2024-01-15" alt="Relative Week" style="max-width: 100%;" /></a>
To include the badge in a markdown file on GitHub, add
![Relative Week](https://img.shields.io/endpoint?url=https://relative-week-ksraqzy7na-uk.a.run.app?genesisDate=2024-01-15)
Note that any parameter for Shields.io can be overwritten. For example, if you want to remove the word "(relative)" from the label, you can provide your own label.
![Relative Week](https://img.shields.io/endpoint?label=Week&url=https://relative-week-ksraqzy7na-uk.a.run.app?genesisDate=2024-01-15)
genesisDate
An ISO format date that represent the staring point. Note that we use week number of ISO Week Date internally. The week starts on Monday and ends on Sunday. The default value is2024-01-15
(15 January 2024).tz
An IANA timezone name. The default value isAmerica/New_York
.format
The output format the function will response in. Choices ofshields-io-json
,json
ortext
. The first is meant to be used with Shields.io while the 2nd outputs more information for debugging. The last format is just a plain text response. The default value isshields-io-json
.
npm install
gcloud functions deploy relative-week \
--gen2 \
--runtime=nodejs20 \
--region=us-east4 \
--source=. \
--entry-point=relativeWeek \
--trigger-http \
--allow-unauthenticated
npm run dev
Then you can visit the URL show on the terminal.
npm test