Skip to content

An API endpoint that display a number of week since an arbitrary date.

License

Notifications You must be signed in to change notification settings

OU-CS3560/relative-week

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relative Week

Relative Week

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.

Usage

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)

Parameters

  • 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 is 2024-01-15 (15 January 2024).
  • tz An IANA timezone name. The default value is America/New_York.
  • format The output format the function will response in. Choices of shields-io-json, json or text. 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 is shields-io-json.

Dependencies

npm install

Production Deployment

gcloud functions deploy relative-week \
        --gen2 \
        --runtime=nodejs20 \
        --region=us-east4 \
        --source=. \
        --entry-point=relativeWeek \
        --trigger-http \
        --allow-unauthenticated

Local Development

npm run dev

Then you can visit the URL show on the terminal.

Test

npm test

About

An API endpoint that display a number of week since an arbitrary date.

Topics

Resources

License

Stars

Watchers

Forks