Comments (9)
oh interesting, yah this is definitely a bug. the morning default of 8am
should have been overwritten in the last example
from date.
I've been trying to look into fixing this bug, but getting stuck as the rAtHour
wont run for date("tomorrow at 9 in the morning")
wont find any matches.
@matthewmueller any tips to where to look ?
from date.
Does it execute: https://github.com/MatthewMueller/date/blob/master/lib/parser.js#L307 ?
from date.
the function athour
does execute but the rAtHour
regex doesn't find any matches
the following prints null
var dateStr = "at 9 in morning"
var rAtHour = /^at\s?(\d{1,2})$/;
console.log(rAtHour.exec(dateStr));
from date.
Ah okay, well that wouldn't execute because it has the $
on the end.
The athour
function should receive the string at 9
though, which should match.
from date.
Oh my example had the wrong dateStr
Now that you mention that, this.str
progressively becomes the following;
test string is "tomorrow at 9 in the morning
at 9 in the morning
9 in the morning
in the morning
the morning
this explains why the rAtHour
regex doesn't run. Looking at the execution of the functions in order
tomorrow
string
number
string
string
morning
from date.
@matthewmueller i've fixed this issue by doing this bulkan@749941d.
Probably, a better way would be to peek
back once from the number and see if the token
is at
from date.
Hey @matthewmueller should I submit a pull request for the changes in bulkan@749941d ❓
from date.
@bulkan yep, then i can review
from date.
Related Issues (20)
- post meridiem is ignored in `"at 3:00 p.m."`, but not in `"at 3:00 pm"`
- Why are you returning a default date when the supplied input is invalid? HOT 1
- Unofficial date.js has new v4.0.0 - possible malware
- How to get start and end date of current month and week?
- function to determine if an input is valid or not
- var _year = 56 * _week
- Add TypeScript support
- Fixes with NLP HOT 2
- Decimal values cause unexpected results
- "100 days ago" not working HOT 5
- Return error if date not understood HOT 2
- '100 days from now' not working HOT 1
- Security Vulnerability in npm package
- Querying 'next monday' on a monday gives you today, when it should return next week's monday
- Error using standalone file in dist HOT 3
- Today is tomorrow HOT 1
- 'at 6.09am' does not work but 'at 6:09am does'
- in 120 seconds return wrong time. HOT 1
- date is undefined: can't import module HOT 1
- date("30 days ago at 18:00") gives date which is 1 month ahead in nodeJS. (instead of 1 month old date)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from date.