Documented Time helper methods don't exist?

Am I missing something?

This page is void of anything helpful:

From there I went to the API, and found this list of methods:

I tried using one, got Method Cake\View\Helper\TimeHelper::diffForHumans does not exist

So I gave up and tried doing it long-hand using vanilla PHP. Eventually I got to the point where I wanted something more concise, so I went back to the Time helpers to try something else and got the error

Method Cake\View\Helper\TimeHelper::toUnixString does not exist

Do any of these methods (other than nice(), which, honestly, though — er — nice, is hardly the most needed shortcut method for dealing with time matters) actually exist?

Why do I keep encountering such appalling issues with the documentation? What in the world is going on?

diffForHumans is not in helper you call it from Time/Date/etc. object i.e. new Cake\i18n\Time() or when you get for instance Datetime data type from database, you can find most of info in its about older lib cake used but since its based on it, the info is mostly accurate

So what you’re saying is the docs are misleading or wrong?

I don’t see anything in the book about any functions, so I have no choice but to look at the API. The API docs make no distinction between, say nice(), and diffForHumans() as being “in” the helper or not.

What is someone who doesn’t know all this stuff to do?

What are we going to do about the docs? Seriously, I volunteer to help out in any way that I can. But not knowing much, I don’t know how much I can help. But I’ll be glad to lend a hand with editing or organizing.

As a community, if we want to evangelize the framework and have a solid foundation for the future, we HAVE to do something about these docs.

I agree the docs are vauge. I usually have better luck on stackoverflow. Some things docs are ok but at least 40% of the stuff could stand better examples or at least a more detailed example.

@calzone sorry i mislead you a bit, chronos is current lib cake uses carbon was previous, i should take a sleep before replying on forums : )

What would you like to see changed in the docs? I took a look at the TimeHelper docs and I agree they are pretty vague. Are there specific use cases you would want to see covered there?

For me personally, the things I’ve seemed to run into with date/time often through the years are:

A) Checking a date from the database / user input versus the current date or another date from user input / database. Often supplied dates are formatted differently or have varying detail (hours and seconds, or not) depending on the source (and db dates are turned into custom Cake “date objects” but at core are just ‘yyyy-mm-dd’). Determining if one comes before or after the other — and what the offset between them is (generally looking for an offset in days). Rarely: checking if a date falls inside a range, or comes before or after said range.

B) Formatting dates echoed in CTP to fit small spaces (columns in tables) or a given customer preference.

C) Formatting times in myriad different ways depending on presentational context needs.

D) Styling dates outputted in (B) according to state determined in (A) — for instance, “this task is overdue” – format in red with blink tag (j/k)

E) Really rarely: checking if a given date is part of a certain week, month, or year (or if arbitrary time plus or minus X hours is still part of today)