• Stars
    star
    1,474
  • Rank 31,891 (Top 0.7 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Date() for humans

date Build Status Libscore

Date is an english language date parser for node.js and the browser. For examples and demos, see: http://matthewmueller.github.io/date/

Update: date.js now has much better NLP support thanks to @kengz

Installation

On the server or in the browser:

npm install date.js

Standalone:

Standalone is also AMD-compatible

Examples

date('10 minutes from now')
date('in 5 hours')
date('at 5pm')
date('at 12:30')
date('at 23:35')
date('in 2 days')
date('tuesday at 9am')
date('monday at 1:00am')
date('last monday at 1:00am')
date('tomorrow at 3pm')
date('yesterday at 12:30am')
date('5pm tonight')
date('tomorrow at noon')
date('next week tuesday')
date('next week tuesday at 4:30pm')
date('2 weeks from wednesday')
date('tomorrow night at 9')
date('tomorrow afternoon')
date('this morning at 9')
date('at 12:30pm')
date('tomorrow at 9 in the morning')
date('2 years from yesterday at 5pm')
date('last month')
date('2nd of January')
date('1st of March')
date('1 st of March')
date('31st of September 4:00am')
date('1st of January 4:00am')
date('9th of December 4:00am')
date('tomorrow afternoon at 4:30pm 1 month from now')
date('10 seconds ago')
date('1 minute ago')
date('2 hours ago')
date('5 weeks ago')
date('2 months ago')
date('1 year ago')
date('an hour later')
date('2w from wednesday')
date('2nd day of January')
date('two hours later')
date('a fortnight from wednesday')
date('a minute ago')

date('at 12:30')
date('at 12.30')
date('tuesday at 9')
date('tomorrow at 15')

API

date(str, [offset])

Create a Date from a str. You may also supply an optional offset to the starting date. offset defaults to the current date and time.

Tests

To run the tests, you'll need node.js:

npm install
make test

Contributors

 project  : date
 repo age : 2 years, 10 months
 active   : 39 days
 commits  : 87
 files    : 17
 authors  :
    27  Matt Mueller       31.0%
    12  Bulkan Evcimen     13.8%
     8  kengz              9.2%
     3  Eero Norri         3.4%
     2  thomas             2.3%
     2  Patrick Stadler    2.3%
     1  Christopher Blum   1.1%
     1  Federico Rampazzo  1.1%
     1  Timothy Cyrus      1.1%
     1  chencheng          1.1%
     1  HipsterBrown       1.1%
     1  Jimmy Gaussen      1.1%

License

(The MIT License)

Copyright (c) 2013 Matt Mueller mailto:[email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

x-ray

The next web scraper. See through the <html> noise.
JavaScript
5,866
star
2

joy

A delightful Go to Javascript compiler (ON HOLD)
Go
1,325
star
3

array

A better array for the browser and node.js. Supports events & many functional goodies.
JavaScript
709
star
4

graph.ql

Faster and simpler way to create GraphQL servers
JavaScript
638
star
5

socrates

Small (8kb), batteries-included redux store to reduce boilerplate and promote good habits.
JavaScript
578
star
6

dots

WIP bootstrapping library for osx & ubuntu (and maybe others!)
Shell
545
star
7

next-cookies

Tiny little function for getting cookies on both client & server with next.js.
JavaScript
369
star
8

coderunner

Run server-side code quickly and securely in the browser.
JavaScript
327
star
9

28kb-react-redux-routing

React + Redux + Routing Stack for just 28kb
JavaScript
245
star
10

vo

Minimalist, yet complete control flow library.
JavaScript
235
star
11

roo

Jump-start your front-end server
JavaScript
104
star
12

component-test

Minimal configuration component test runner supporting browser testing, phantomjs, and saucelabs.
JavaScript
98
star
13

mini-html-parser

Mini HTML parser for webworkers / node. Intended for well-formed HTML.
JavaScript
83
star
14

node-nom

Dead simple site scrapper for Node.js
JavaScript
74
star
15

outliers

Find outliers in a dataset.
JavaScript
56
star
16

next-redirect

Redirect for next.js. Works on both the client and server
JavaScript
52
star
17

try-again

Generic, simple retry module with exponential backoff.
JavaScript
52
star
18

PHPUnit-Test-Report

Browser testing with PHPUnit
PHP
45
star
19

x-ray-crawler

Friendly web crawler for x-ray
JavaScript
44
star
20

pg-bridge

Simple service connecting PostgreSQL notifications to Amazon SNS.
Go
44
star
21

go-datadog

Easily send structured logs to Datadog over TCP.
Go
39
star
22

svg

low-level svg helper
JavaScript
37
star
23

preact-head

Standalone, declarative <Head /> for Preact.
JavaScript
37
star
24

adjust

Position elements next to each other. A light-weight version of HubSpot/tether.
JavaScript
36
star
25

wrap-fn

Low-level wrapper to easily support sync, async, and generator functions.
JavaScript
34
star
26

dom-iterator

Feature-rich, well-tested Iterator for traversing DOM nodes.
JavaScript
34
star
27

normalize-contenteditable

All text in a content-editable block should be wrapped in <p> tag.
JavaScript
34
star
28

ppi

Find the PPI (pixels per inch) of an image.
JavaScript
33
star
29

next-route

Simplified custom routing for next.js.
JavaScript
33
star
30

tipp

Tool tips that just work.
JavaScript
31
star
31

combine-errors

Simple way to combine multiple errors into one.
JavaScript
31
star
32

poss

Slightly better-looking error handling for async/await & generators
JavaScript
28
star
33

autocomplete

Flexible autocomplete component
JavaScript
26
star
34

envobj

Tiny environment variable helper, that I'll use in all my apps.
TypeScript
25
star
35

qr-code

Create QR codes
JavaScript
25
star
36

vcom

Everything you need to create virtual Preact Components with CSS, HTML, and JS.
JavaScript
21
star
37

tiny-store

Tiny immutable store for any value
JavaScript
21
star
38

blocktree

Back to the basics, Hickey-inspired, generic text parser
JavaScript
21
star
39

unmatrix

Parse and normalize the individual values of a css transform
JavaScript
21
star
40

enqueue

seamlessly queue up asynchronous function calls. supports concurrency and timeouts.
JavaScript
20
star
41

string-scanner

scan through strings. supports forwards and backwards scanning.
JavaScript
19
star
42

step.js

My kind of step library. no dependencies. 120 lines of code. 383 lines of tests.
JavaScript
18
star
43

every

human-friendly intervals using http://github.com/matthewmueller/date
JavaScript
17
star
44

json-to-dom

Fill in DOM nodes with JSON. Supports arrays and attributes.
JavaScript
17
star
45

pretty-html

HTML logging that's easy on the eyes.
JavaScript
17
star
46

preact-socrates

preact plugin for socrates.
JavaScript
16
star
47

time-series

simple streaming time series graphs. automatic rescaling as data streams in.
JavaScript
16
star
48

event-debugger

step through events! must be initialized at the top of your scripts.
JavaScript
16
star
49

sun

Simple little virtual DOM node builder for Preact.
JavaScript
15
star
50

x-ray-parse

x-ray's selector parser.
JavaScript
15
star
51

file-pipe

Use gulp plugins on individual files
JavaScript
14
star
52

title-capitalization

Properly capitalize English titles.
JavaScript
14
star
53

atom-standard

An on-save linter and formatter for atom using standard. Supports all the options that standard supports.
JavaScript
14
star
54

express-graph.ql

Express middleware for querying our graphql server built with graph.ql
JavaScript
13
star
55

murmur.js

Small murmur hash implementation.
JavaScript
13
star
56

mergin

Merges files together using a best-effort merge
JavaScript
13
star
57

next-flash

Flash messages for next.js. Works on both the client and the server.
JavaScript
13
star
58

image-search

Pluggable image search
JavaScript
13
star
59

redux-routes

Simple redux history middleware.
JavaScript
13
star
60

io

higher-level engine.io client.
JavaScript
12
star
61

stripe-checkout

Open Stripe Checkout programmatically
JavaScript
12
star
62

remember

Use localstorage to remember input values. Supports textareas and inputs including radio buttons and checkboxes.
JavaScript
12
star
63

internal-old

Internal queue for your public libraries and APIs
JavaScript
11
star
64

preact-rc

Remote control your Preact components
JavaScript
11
star
65

subs

tiny string substitution
JavaScript
10
star
66

lambda-serve

Use koa or express on lambda!
JavaScript
10
star
67

grow

Grow textareas without using a clone or ghost element.
JavaScript
10
star
68

better-error

easier, more colorful, sprintf-style errors
JavaScript
10
star
69

spreadsheet

NOTE: this project is quite old. I won't be maintaining it anymore, but it should still work :-)
JavaScript
10
star
70

debounce

Underscore's debounce method as a component.
JavaScript
10
star
71

typewriter

Animated typing
JavaScript
9
star
72

async-script-promise

Asynchronously load scripts
JavaScript
9
star
73

reverse-regex

flip a regular expression. allows you to efficiently search backwards.
JavaScript
9
star
74

gist

Fluent gist API for node.js.
JavaScript
9
star
75

unyield

allow generators functions to accept callbacks
JavaScript
9
star
76

cheerio-select

Tiny wrapper around FB55's excellent CSSselect library.
JavaScript
9
star
77

terraform-provider-url

Simple little Terraform data source for parsing URLs.
Go
9
star
78

mdb

In-memory key/value store designed for concurrent use
Go
9
star
79

cursors

Collection of Mac's native cursor elements
8
star
80

increment

increment strings. good for keeping slugs unique.
JavaScript
8
star
81

wrapped

Low-level wrapper to provide a consistent interface for sync, async, promises, and generator functions.
JavaScript
8
star
82

yieldly

Conditionally make functions yieldable
JavaScript
8
star
83

events

Stand-alone event bindings as a component based on how Backbone's views handle events.
JavaScript
8
star
84

color

Extremely basic color tinting component
JavaScript
8
star
85

vscode-proofie

Proofie is an experimental proof-reader for VSCode that helps you write better.
TypeScript
8
star
86

plumbing

Pluggable plumbing for your Javascript libraries.
JavaScript
7
star
87

clock

Create a swiss railway inspired clock.
HTML
7
star
88

routematch

simple, functional route matcher for node.js and the browser.
JavaScript
7
star
89

character-iterator

Iterate through text characters in the DOM tree. Handles parent & sibling relationships.
JavaScript
7
star
90

sns.js

Simple publish and parse module for AWS SNS
JavaScript
7
star
91

hex-to-color-name

Tiny module to map hex colors to color names of your choice.
JavaScript
7
star
92

hackernews

Go
7
star
93

css-to-js-object

Experimental: convert css to a JS object.
JavaScript
7
star
94

number-to-letter

Simple utility to convert an arbitrary number to a letter
JavaScript
7
star
95

rework-count

Rework plugin to style elements based on the sibling count.
JavaScript
6
star
96

arg-deps

Statically inspect a function to get the properties of its arguments. Works with minified code.
JavaScript
6
star
97

extend.js

extend objects. extend(obj, obj2, ...)
JavaScript
6
star
98

invisibles

make spaces visible
JavaScript
6
star
99

email

fluent email using sendmail
JavaScript
6
star
100

coderunner-api

API for coderunner
JavaScript
6
star