1
0
Fork 0
No description
Find a file
2023-08-02 12:57:45 +02:00
go.mod Initial commit 2023-08-02 12:57:45 +02:00
main.go Initial commit 2023-08-02 12:57:45 +02:00
README.md Initial commit 2023-08-02 12:57:45 +02:00

calweek

Simple REST Api that let's you get the current calendar week written in Go

Endpoints

/

Returns you a single number of the current week

$ curl http(s)://<your-endpoint>/
29

/json

Returns you the requested week number alongside with the offset and the used timestamp for the calculation in a JSON format.

$ curl http(s)://<your-endpoint>/json
{
  "week": 29,
  "offset": 0,
  "timestamp": "2022-07-22T18:23:56.092666776Z"
}

Params

Possible url params that are accepted by the API.

offset

Offset in hours to the UTC time

The backend uses the current UTC time as base for it's calculations. If you are verry serious about getting the correct week number, you can pass the optional url param offste to get the week number calculated based on your current timezone.

As an example, if you wand JSON data for the timezone Europe/Zurich during summer time, you would send a request to /json?offset=2.

$ curl http(s)://<your-endpoint>/json?offset=2
{
  "week": 29,
  "offset": 2,
  "timestamp": "2022-07-22T20:30:51.48291194Z"
}