Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add International date format support #25

Merged
merged 4 commits into from Apr 30, 2018
Merged

Conversation

gotbahn
Copy link
Contributor

@gotbahn gotbahn commented Apr 16, 2018

Hey there, thx for a nice package. As European user, I want to have possibility declare dates in European format DD-MM-YYYY. This PR extends Date regex with it.

@ungoldman
Copy link
Owner

Hi @godban, thanks for the PR! Since there are a lot of variations of date formats, maybe we should go with the most permissive, which I think would be

1-4 numbers, delimiter (-,.,/), 1-2 numbers, delimiter, 1-4 numbers

That way all the following would be valid dates:

2018-04-16
16.04.2018
4/16/18

What do you think?

@gotbahn gotbahn changed the title Add European date format support Add International date format support Apr 16, 2018
@gotbahn
Copy link
Contributor Author

gotbahn commented Apr 16, 2018

@ungoldman yea, make sense. Updated

@gotbahn
Copy link
Contributor Author

gotbahn commented Apr 30, 2018

so... what's up, Doc?

@@ -4,7 +4,7 @@ var removeMarkdown = require('remove-markdown')

// patterns
var semver = /\[?v?([\w\d.-]+\.[\w\d.-]+[a-zA-Z0-9])\]?/
var date = /.*([\d]{4}-[\d]{2}-[\d]{2}).*/
var date = /.*[ ](\d\d?\d?\d?[-/.]\d\d?[-/.]\d\d?\d?\d?).*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ ] is not necessary here (means "one of one whitespace" basically). Otherwise looks good.

https://regexper.com/#%2F.*%5B%20%5D%28%5B%5Cd%5D%7B4%7D%5B-%2F.%5D%5B%5Cd%5D%7B2%7D%5B-%2F.%5D%5B%5Cd%5D%7B4%7D%29.*%2F

@ungoldman
Copy link
Owner

Hi @godban. Sorry I've been busy. Looks good enough, thanks.

@ungoldman ungoldman merged commit 786224b into ungoldman:master Apr 30, 2018
@ungoldman
Copy link
Owner

📦 2.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants