https://github.com/linusu/utc-version
https://github.com/linusu/utc-version
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/linusu/utc-version
- Owner: LinusU
- Created: 2018-01-22T14:47:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-24T07:27:16.000Z (almost 6 years ago)
- Last Synced: 2025-05-07T23:46:06.911Z (about 1 year ago)
- Language: JavaScript
- Size: 67.4 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# UTC Version
Return a version string based on the current date and time. If you prefer automatically generating date-only versions based on your latest git tag, try [daily-version](https://github.com/fregante/daily-version).
## Installation
```sh
npm intall --save utc-version
```
## Usage
JavaScript:
```js
const utcVersion = require('utc-version')
console.log(utcVersion())
//=> 18.1.22.1441
console.log(utcVersion({ apple: true }))
//=> 18.1.22i157
console.log(utcVersion({ short: true }))
//=> 18.1.22
```
Shell:
```sh
$ utc-version
18.1.22.1441
$ utc-version --apple
18.1.22i157
$ utc-version --short
18.1.22
```
## API
### `utcVersion([date], [options]) => string`
Return a version string based on the `Date`-object passed in. If no time is given, the current time is used.
If `options.apple` is truthy, the version string will be compatible with Apples restrictions on `CFBundleVersion`. The format will be `year.month.day` followed by `i` and a number between 1 and 255 inclusively. The `i` number is increased rughly every 5 minutes and 39 seconds.
If `options.short` is truthy, the format will be `year.month.day`, without seconds.