https://github.com/moeki0/requested-at
Requested time mockable with query string
https://github.com/moeki0/requested-at
datetime javascript npm
Last synced: 5 months ago
JSON representation
Requested time mockable with query string
- Host: GitHub
- URL: https://github.com/moeki0/requested-at
- Owner: moeki0
- License: bsd-2-clause
- Created: 2021-10-05T06:53:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-05T09:04:03.000Z (over 4 years ago)
- Last Synced: 2025-07-31T13:37:11.009Z (6 months ago)
- Topics: datetime, javascript, npm
- Language: JavaScript
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Requested At
## 使い方
```js
import RequestedAt from 'requested-at'
new RequestedAt({ env: 'production' }).getDate()
// Tue Oct 05 2021 17:42:27 GMT+0900 (日本標準時)
```
## クエリパラメータによるリクエストした日付の定義
以下のようにクエリパラメータを指定する。
```url
http://example.com?date=2022-01-01
```
```js
new RequestedAt({ env: 'development' }).getDate()
// Tue Feb 01 2022 00:00:00 GMT+0900 (日本標準時)
new RequestedAt({ env: 'staging' }).getDate()
// Tue Feb 01 2022 00:00:00 GMT+0900 (日本標準時)
```
環境を `production` に指定した場合には、ユーザー定義の日付は無視される。
```js
new RequestedAt({ env: 'production' }).getDate()
// Tue Oct 05 2021 17:42:27 GMT+0900 (日本標準時)
```