GithubHelp home page GithubHelp logo

date's Issues

Abbreviations

Such as;
1m for 1 month, or 3w for 3 weeks, etc.
It would be great.

"3.99" is interpreted as 4.39am

var date = require('date.js'); console.log(date('3.99'));

This gives the output Wed Jan 06 2016 04:39:00 GMT+0530 (India Standard Time)

Shouldn't such strings indicate invalid time? What do you think?

Timezone question

Hi,

Have you considered adding timezone support e.g:in 30 minutes EEST ?
This would make it really nice.

Thanks!

Midnight

I see that noon was supported, but not midnight. Great work by the way! 👍

Making a guess at "tomorrow at 11"

When you enter at a time without specifying AM or PM or something to frame that time (e.g. morning), it ignores the time value.

tomorrow morning at 11
tomorrow at 11am
tomorrow at 11:00
tomorrow at 11

Of those 4 examples, the first 3 give the same result, the last one ignores the time.

I would have thought presuming someone is using a 24 hour clock format is the best way to handle this, so tomorrow at 11 always defaults to 11am?

tonight at 9:30

tonight at 9 parses correctly to 09:00PM
add the minutes it goes cray cray, tonight at 9:30 parses to 09:30AM

return null if can't parse a date

by default, date appears to return the new Date() if it couldn't make sense of the input.
this isn't really ideal.
it's pretty easy to do

var d = date(string) || new Date()

Otherwise, there isn't an easy way to tell if it's a valid time or not.

Support for non-relative date-time strings

It would be useful if this library could also parse non-relative strings. I was rather perplexed to find:

> d("September 11, 2014");
> Fri Sep 12 2014 11:45:01 GMT+1000 (EST)

I know the plain old Date constructor will handle that, but it'd be nice not to have to worry about whether a date is relative or not and still have the other natural-language advantages this library has.

Doesn't recognize "next <month>"

For example, "next july 1" or "next july". Neither work. I know I use this type of relative date notation often in conversation.

Crashes when entering non-english characters

Trying to enter Cyrillic into the input box causes the JS/page to become un-responsive.

For example trying to enter завтра will crash after the first two characters are entered.

Liscense

I don't see a license of any sort attached to this. Would make it easier to use on projects without worry.

2 hours work but not 'two' hours

Hi,
There should be a mapping of 2 with the word two so that it recognizes when someone types two hours from now, and extending it to 0 to 60

Thanks,
Fakhruddin

"at X in the morning" defaults to 8am, rather than Xam

Including morning after the time number overrides to 8am.

Examples:
date("tomorrow morning") // tomorrow morning at 8am correct-ish
date("tomorrow morning at 9") // tomorrow morning at 9am correct
date("tomorrow at 9 in the morning") // tomorrow morning at 8am wrong

favour current day (optionally?)

tough call for this I guess, if you enter something like "1pm" I guess it's ambiguous, for my cases favouring the recently-passed 1pm would be better than the next, right now we'd have to use "last 1pm" which is a little awkward haha. Anyway let me know what you think or if you have any ideas

Support for before/after

As a follow up to issue #54, I would like to request relative times to be added. This library would become part of an automation system where I would like to schedule actions based on sunrise and sunset times, but with an offset. Examples would be:

10 minutes after sunset

or

next monday 1 hour before sunrise 

So, 'sunrise' and 'sunset' would be calculated as specified in issue #54. This issue would probably only be needed if #54 was implemented.

Thanks again!

Add context extensions.

Consider setting up beginning and end date for tasks

Start: Next Monday
End: Two weeks from Start

and start value to take from context.

test fails at certain times of the day

Need to be more explicit with this test case:

describe('parse context if its a string (fixes: #38)', function () {
  it('string context', function () {
    var today = new Date();
    var date = parse('today at 11', "yesterday");
    assert(d(date) == d(today));
    assert('11:00:00' == t(date));
  });
});

Demo clicks broken in FireFox

Win7, FF24 & Aurora28.0a2
Typing the text box works as intended, but clicking on the pre-rolled examples below causes undefined & a freeze up.
Works fine in Chrome Beta & IE10 on same machine.
TIA

"Tomorrow"

Seems odd to me that date supports "next week tuesday", but not other day-only-type dates, like "Tomorrow." In my ideal world, this would use some natural UX like date pickers in calendars, where it automatically assumes "This time tomorrow." Would also +1 the other ticket suggestions (like being able to return null on no-match).

Thanks for such a great lib!

Support of EDTF?

Is there any interest in extending the date representation used to support EDTF?

As far as I can see there is nothing in the date representation to indicate that any given date represents an approximate date/time. It would be great to retain this aspect of parsed date/time strings.

For example parsing a date like "Tomorrow afternoon" is useful, however to then output this date again without distorting meaning we need to know that the 2pm part of the resulting date object is inferred and approximate.

i18n?

First of all - good job on the plugin.

Any plans to allow easy translating to different languages and switching between them?

Regards

holidays?

Could be cool to use holidays as an anchor: "I'll be back in the office tuesday after thanksgiving"

Bonus points: combine with #32 and do something like "I'll be gone thanksgiving weekend" ==> Thurs Nov 28 - Sun Dec 1

same results for "ago" and "from now"

  console.log(date('50 minutes ago'));
  console.log(date('50 minutes from now'));

Tue Feb 04 2014 19:47:44 GMT-0800 (PST)
Tue Feb 04 2014 19:47:44 GMT-0800 (PST)

going to use this for a badass log query language :D

Fun change - support overmorrow and ereyesterday!

This is not an issue or bug, but it might be fun to support the (sadly) no longer used English words "overmorrow" (the day after tomorrow) and "ereyesterday" (the day before yesterday).

Other languages have words for this, e.g. übermorgen and vorgestern in German, so it might be useful (especially if you add multilanguage support in the future?)

They can also be used to mean things like "the day after the day after tomorrow" : overovermorrow and "the day before the day before yesterday" : ereereyesterday.

As I said, more for a bit of fun rather than an issue with this very useful library!

Support for date-specific times

I would love for this library to support tokens that calculate the time. To be concrete, it would be brilliant if I could, for example, get the sunrise time for a particular date, or the sunset time (e.g. 'next week monday at sunrise'). This depends on a) the date and b) the location. (See also https://github.com/mourner/suncalc) Another example could be 'wakeuptime' that's set to 7:00 during the week and 10:00 in the weekends.

I can imagine something along the lines of registering a token (e.g. 'sunset') with the parser with a callback function that gets passed the determined date and returns the appropriate time.

Easy example (registering 'midnight' as a token):

date.register('midnight', function(d) { return d.setHours(0, 0, 0) });

I know 'midnight' already exists, but it's just an example. This feature could also make 'evening', 'night', and so on more dynamic and user customizable.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.