Parser: better year parsing on *NIX lists #72

Merged
merged 2 commits into from Jan 9, 2014

Conversation

Projects
None yet
3 participants
@maximethebault
Contributor

maximethebault commented Jan 7, 2014

When getting a *NIX-like list, the library is using the local machine's current year to guess the modification date of a directory/file which can be wrong.

Even though FTP's lists are a mess, most of them seem to be using the ls behavior:
For files with a time that is more than 6 months old or more than 1 hour into the future, the timestamp contains the year instead of the time of day.

Because of the lack of timezone support in the FTP standards, it's not always possible to guess the right year, but it's possible to improve the guess.

This patch wasn't fully tested.

I've put lots of comments (because I needed them - dealing with dates + timezones can get complicated), feel free to get rid of them.

@jvonniedapn

This comment has been minimized.

Show comment Hide comment
@jvonniedapn

jvonniedapn Jan 9, 2014

The bug that this patch fixes just bit me by making it look like all files from last year were from this year. Consider this a vote to please merge this and push it to npm :)

The bug that this patch fixes just bit me by making it look like all files from last year were from this year. Consider this a vote to please merge this and push it to npm :)

mscdex added a commit that referenced this pull request Jan 9, 2014

Merge pull request #72 from maximethebault/master
Parser: better year parsing on *NIX lists

@mscdex mscdex merged commit 3b4b5aa into mscdex:master Jan 9, 2014

@mscdex

This comment has been minimized.

Show comment Hide comment
@mscdex

mscdex Jan 9, 2014

Owner

Thanks!

Owner

mscdex commented Jan 9, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment