Code Monkey home page Code Monkey logo

expressive-date's People

Contributors

jasonlewis avatar msurguy avatar yurytolochko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

expressive-date's Issues

Additional methods: startOfWeek, endOfWeek, copy

it would be awesome to have some additional methods:

  • startOfWeek() - get start date of the week
  • endOfWeek() - get end date of the week
  • copy() - clone current date (usage: $date->copy()->startOfWeek())

Week methods also will require week start day definition:

  • setWeekStartDay(0) - set Sunday is first day of the week (by default)
  • setWeekStartDay(1) - set Monday is first day of the week

Also would be great to hint magic methods like getDay(),setMonth() and etc

What is the namespace to use via composer?

I'm trying to use ExpressiveDate via composer although I cannot figure it out. I've tried...

$date = new \ExpressiveDate\ExpressiveDate();
$date = new \ExpressiveDate();
$date = new ExpressiveDate();

Support for business days and holidays

Have you thought at all about adding support for business days?

So for example, if

$date = new ExpressiveDate;  // Let's say this is a Friday
$date->addDays(1);  // This would give you Saturday

$date->addBusinessDays(1);  // This would give you Monday

Support for holidays would be a little more complicated, because we would probably need to pass in the holidays into object configuration somehow, since it will vary by country / locale.

But maybe, $holidays were an array of date objects:

$holidays = array(
    $monday
);
ExpressiveDave::initializeHolidays($holidays);
$date->addBusinessDays(1); // This would be Tuesday, since Monday is holiday

Translations for long date

Hi,
Major problem with PHP is that we can get long date only in English. I want to be able to get long date also in other languages.
For example, in English:
1 Jan 1970 / 1 January 1970
And in Polish:
1 sty 1970 / 1 stycznia 1970
Of course, I don't expect you to include translations by default. I only want to be able to translate it by myself using your lib.

i18n for text

I would like to use your php extension. I would like to translate (getRelativeDate() / $units prefix, postfix etc.). Can you solve this problem? For example if the extension use language file.. then I be able to translate. Thanks for your support.

Add if less than X days display relative, otherwise use Y

It would be cool to be able to use relative date to a specific length, then use a more normal date.

Currently I write it something like this (pseudocode):

$date = new ExpressiveDate('January 31, 1991');
$current = new ExpressiveDate();

if($current->lessOrEqualTo($date->clone()->addOneWeek())) {
return $date->getRelativeDate();
} else {
return $date->getShortDate();
}

minusHours(.5) throws an exception

Trying to use minusHours() with anything less than one but greater than 0 throws the following exception.

Exception: DateInterval::__construct(): Unknown or bad format (PT0.5H)

There should be a check inside of modifyHours() that looks for floats between 0 and 1 and redirects them to modifyMinutes instead, since its perfectly reasonable that somebody might be trying to pass a fraction of an hour.

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.