Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanmonstar/utcstring
UTC date format utilities
https://github.com/seanmonstar/utcstring
Last synced: about 1 month ago
JSON representation
UTC date format utilities
- Host: GitHub
- URL: https://github.com/seanmonstar/utcstring
- Owner: seanmonstar
- License: mpl-2.0
- Created: 2013-10-30T18:23:35.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-05T20:01:03.000Z (about 11 years ago)
- Last Synced: 2024-10-05T04:23:44.439Z (about 1 month ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# utcstring
[![Build Status](https://travis-ci.org/seanmonstar/utcstring.png?branch=master)](https://travis-ci.org/seanmonstar/utcstring)
[![NPM version](https://badge.fury.io/js/utcstring.png)](http://badge.fury.io/js/utcstring)UTC date format utilities.
## Usage
```js
var utc = require('utcstring');utc() // now in UTC string format
utc(new Date()) // date in UTC string; same as (new Date).toUTCString();utc.is('Thu, 30 Oct 2013 11:15:21 GMT') // returns true
utc.is('Thu, 30 Oct 2013') // returns falseutc.has('Today is Thu, 30 Oct 2013 11:15:21 GMT, hurray!') // true
utc.match('Today is Thu, 30 Oct 2013 11:15:21 GMT, hurray!') // ['Thu, 30 Oct 2013 11:15:21 GMT']
// essentially utc.match()[0]
utc.get('Today is Thu, 30 Oct 2013 11:15:21 GMT, hurray!') // 'Thu, 30 Oct 2013 11:15:21 GMT'// checks utc.is(str) before parsing as Date
utc.from('Thu, 30 Oct 2013 11:15:21 GMT') // Date instance
utc.from('2013-10-30') // null
```## License
MPLv2.0