wanasit / chrono

A natural language date parser in Javascript
MIT License
4.55k stars 340 forks source link

feat: add support to unix timestamp #549

Open RodrigoDornelles opened 5 months ago

RodrigoDornelles commented 5 months ago

It is interesting to support the Posix standard as one of the formats compatible with the parser.

wanasit commented 4 months ago

Hello. Sorry for my slow reply and thank you for your suggestion.

Could you clarify what Posix standard/pattern/format you mean? (link?) Or you are suggesting we should recognize 10digits numbers in the possible range (e.g. 1717236990) as a timestamp?

If it's the latter, I'm not sure if we should include it in the default setting.

RodrigoDornelles commented 4 months ago

Could you clarify what Posix standard/pattern/format you mean? (link?) Or you are suggesting we should recognize 10digits numbers in the possible range (e.g. 1717236990) as a timestamp?

That would be it, you wouldn't need a decorator around the function, maybe it supports unix:1111111111, it's not human readable which is what the lib proposes, but it ends up being useful anyway.