diff options
Diffstat (limited to 'src/node_modules/chance/docs/time')
-rw-r--r-- | src/node_modules/chance/docs/time/ampm.md | 13 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/date.md | 67 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/hammertime.md | 25 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/hour.md | 27 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/millisecond.md | 15 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/minute.md | 15 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/month.md | 23 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/second.md | 15 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/timestamp.md | 14 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/timezone.md | 20 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/weekday.md | 16 | ||||
-rw-r--r-- | src/node_modules/chance/docs/time/year.md | 31 |
12 files changed, 281 insertions, 0 deletions
diff --git a/src/node_modules/chance/docs/time/ampm.md b/src/node_modules/chance/docs/time/ampm.md new file mode 100644 index 0000000..5f38aa7 --- /dev/null +++ b/src/node_modules/chance/docs/time/ampm.md @@ -0,0 +1,13 @@ +# ampm + +```js +// usage +chance.ampm() +``` + +Return am or pm. Very simple. + +```js +chance.ampm(); +=> 'am' +``` diff --git a/src/node_modules/chance/docs/time/date.md b/src/node_modules/chance/docs/time/date.md new file mode 100644 index 0000000..53ae5ca --- /dev/null +++ b/src/node_modules/chance/docs/time/date.md @@ -0,0 +1,67 @@ +# date + +```js +// usage +chance.date() +chance.date({string: true}) +chance.date({string: true, american: false}) +chance.date({year: 1983}) +``` + +Generate a random date + +```js +chance.date(); +=> Sat Apr 09 2072 00:00:00 GMT-0400 (EDT) +``` + +By default, returns an actual [Date][Date] object + +Can optionally specify that a date be returned as a string + +```js +chance.date({string: true}); +=> "5/27/2078" +``` + +This will return a date string of the format MM/DD/YYYY. + +Now of course MM/DD/YYYY is the "American" date method, but it's the default +because there isn't much support for internationalization here yet. Further, +it's the format used by [Facebook][FB] and other services for birthdays and +other non-Date object dates. + +However, we support returning dates in DD/MM/YYYY format as well when requesting +a date by a string and passing `american: false`. + +```js +chance.date({string: true, american: false}); +=> "13/2/2017" +``` + +If you want richer control over date format, strongly suggest using the +[Moment][Moment] library. Our formatting is very minimalist, and it's out of our +core competency to offer dates in a myriad of formats. + +Can optionally specify defaults for any of day, month, or year. + +```js +chance.date({year: 1983}); +=> Wed May 04 1983 00:00:00 GMT-0400 (EDT) + +chance.date({month: 0}); +=> Tue Jan 18 2084 00:00:00 GMT-0500 (EST) + +chance.date({day: 21}); +=> Sun Oct 21 2103 00:00:00 GMT-0400 (EDT) +``` + +A random date is generated, but the default you specify is kept constant. + +Note, month is 0-indexed. This is a carryover from the core JavaScript +[Date][Date] object which we use internally to generate the date. We +considered + +[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date +[FB]: https://developers.facebook.com/docs/reference/api/user/ +[Moment]: http://momentjs.com diff --git a/src/node_modules/chance/docs/time/hammertime.md b/src/node_modules/chance/docs/time/hammertime.md new file mode 100644 index 0000000..75b0985 --- /dev/null +++ b/src/node_modules/chance/docs/time/hammertime.md @@ -0,0 +1,25 @@ +# hammertime + +```js +// usage +chance.hammertime() +``` + +<p class="pullquote" data-pullquote='Stop. Hammertime.' markdown="1"></p> + +Generate a random hammertime. + +```js +chance.hammertime(); +=> 2273327300317 +``` + +Hammertime is the name given to a [Unix time](http://en.wikipedia.org/wiki/Unix_time) with +milliseconds. Which is the same as saying the number of milliseconds since 1970. It has +finer granularity than a normal Unix timestamp and thus is often used in realtime +applications. + +According to startup lore, Hammertime was coined by a startup whose founder had an +interesting interaction with M.C. Hammer. There was no name given to "Unix time with +milliseconds" and while brainstorming ideas (because Unix time with milliseconds is +a confusing mouthful), someone suggested Hammertime and it stuck. diff --git a/src/node_modules/chance/docs/time/hour.md b/src/node_modules/chance/docs/time/hour.md new file mode 100644 index 0000000..02e06d0 --- /dev/null +++ b/src/node_modules/chance/docs/time/hour.md @@ -0,0 +1,27 @@ +# hour + +```js +// usage +chance.hour() +chance.hour({twentyfour: true}) +``` + +Generate a random hour + +```js +chance.hour(); +=> 9 +``` + +By default, returns an hour from 1 to 12 for a standard [12-hour clock][12h]. + +Can optionally specify a full twenty-four. + +```js +chance.hour({twentyfour: true}); +=> 21 +``` + +This will return an hour from 1 to 24. + +[12h]: https://en.wikipedia.org/wiki/12-hour_clock diff --git a/src/node_modules/chance/docs/time/millisecond.md b/src/node_modules/chance/docs/time/millisecond.md new file mode 100644 index 0000000..6751985 --- /dev/null +++ b/src/node_modules/chance/docs/time/millisecond.md @@ -0,0 +1,15 @@ +# millisecond + +```js +// usage +chance.millisecond() +``` + +Generate a random millisecond + +```js +chance.millisecond(); +=> 729 +``` + +By default, returns a millisecond from 0 to 999. Idea is for generating a clock time. diff --git a/src/node_modules/chance/docs/time/minute.md b/src/node_modules/chance/docs/time/minute.md new file mode 100644 index 0000000..e42f8cb --- /dev/null +++ b/src/node_modules/chance/docs/time/minute.md @@ -0,0 +1,15 @@ +# minute + +```js +// usage +chance.minute() +``` + +Generate a random minute + +```js +chance.minute(); +=> 35 +``` + +By default, returns a minute from 0 to 59. Idea is for generating a clock time. diff --git a/src/node_modules/chance/docs/time/month.md b/src/node_modules/chance/docs/time/month.md new file mode 100644 index 0000000..83bffd5 --- /dev/null +++ b/src/node_modules/chance/docs/time/month.md @@ -0,0 +1,23 @@ +# month + +```js +// usage +chance.month() +``` + +Generate a random month. + +```js +chance.month(); +=> 'January' +``` + +By default, returns just the full name. + +Optionally specify raw to get the whole month object consisting of name, +short_name, and numeric. + +```js +chance.month({raw: true}); +=> {name: 'October', short_name: 'Oct', numeric: '10'} +``` diff --git a/src/node_modules/chance/docs/time/second.md b/src/node_modules/chance/docs/time/second.md new file mode 100644 index 0000000..00c565e --- /dev/null +++ b/src/node_modules/chance/docs/time/second.md @@ -0,0 +1,15 @@ +# second + +```js +// usage +chance.second() +``` + +Generate a random second + +```js +chance.second(); +=> 19 +``` + +By default, returns a second from 0 to 59. Idea is for generating a clock time. diff --git a/src/node_modules/chance/docs/time/timestamp.md b/src/node_modules/chance/docs/time/timestamp.md new file mode 100644 index 0000000..400a2ee --- /dev/null +++ b/src/node_modules/chance/docs/time/timestamp.md @@ -0,0 +1,14 @@ +# timestamp + +```js +// usage +chance.timestamp() +``` + +Generate a random timestamp. This is a standard Unix time, so a random number of +seconds since January 1, 1970. + +```js +chance.timestamp(); +=> 576556683 +``` diff --git a/src/node_modules/chance/docs/time/timezone.md b/src/node_modules/chance/docs/time/timezone.md new file mode 100644 index 0000000..5d9247e --- /dev/null +++ b/src/node_modules/chance/docs/time/timezone.md @@ -0,0 +1,20 @@ +# timezone + +```js +// usage +chance.timezone() +``` + +Return a random timezone + +```js +chance.timezone(); +=> { +"name": "India Standard Time", +"abbr": "IST", +"offset": 5.5, +"isdst": false, +"text": "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi", +"utc": ["Asia/Calcutta"] +} +``` diff --git a/src/node_modules/chance/docs/time/weekday.md b/src/node_modules/chance/docs/time/weekday.md new file mode 100644 index 0000000..05f5484 --- /dev/null +++ b/src/node_modules/chance/docs/time/weekday.md @@ -0,0 +1,16 @@ +# weekday + +```js +// usage +chance.weekday() +chance.weekday({weekday_only: true}) +``` + +Return a weekday + +```js +chance.weekday(); +=> 'Tuesday' +``` + +By default, weekday_only is false. If set to true it will never return Saturday or Sunday. diff --git a/src/node_modules/chance/docs/time/year.md b/src/node_modules/chance/docs/time/year.md new file mode 100644 index 0000000..4ef4527 --- /dev/null +++ b/src/node_modules/chance/docs/time/year.md @@ -0,0 +1,31 @@ +# year + +```js +// usage +chance.year() +chance.year({min: 1900, max: 2100}) +``` + +Generate a random year + +```js +chance.year(); +=> '2053' +``` + +By default, min is the current year and max is 100 years greater than min. + +This is returned as a string. If for some reason you need it numeric, just +parse it: + +```js +parseInt(chance.year()); +=> 2042 +``` + +Optionally specify min, max, or both to limit the range. + +```js +chance.year({min: 1900, max: 2100}); +=> '1983' +``` |