question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Date in list is incorrect

See original GitHub issue

Calling list() is returning the wrong date. It’s an hour off (at least here on a danish computer GMT+2) and its missing seconds. Calling lastMod() returns the right date. My guess is that the missing precision is due to the ftp command LIST is not showing the seconds, but the hour off should be fixed in my oppinion.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
maximethebaultcommented, Jun 4, 2015

As far as I know, the library is relying on the raw data returned by the command and doesn’t try to figure out the timezone on its own (you should check the raw data returned by the LIST command, I suspect they’ll be one hour off as well). The issue is not caused by the library directly, but because of the FTP protocol itself, and more particularly because of the LIST command, which has very loose specifications. The LIST command basically returns the output of a “ls” command and is not designed to handle timezones!

Two possible fixes :

  • issue a lastMod() on a specific file to get its UTC timestamp, compare it with the time returned by list() for this same file, compute the difference and apply it to all the times returned by the list command. This fix is/was used on some ftp clients (FlashFXP is one of them if I remember well), but is to my opinion out of the scope of this library as it implies a lot of hidden commands, and requires at least one file/directory to be present on the FTP server. But feel free to implement this fix in the code that uses the library.
  • the recommended way: use the MLSD command, which returns UTC time (see the RFC: https://tools.ietf.org/html/rfc3659). It’s the only reliable way to deal with timezones. Unfortunately, it’s not available on all FTP servers. In such case, you’ll have to use the first fix as fallback.

NB: lastMod() issues a “MDTM” command, which returns an UTC timestamp. If it’s available on your FTP server, MLSD will probably be available as well since they were both defined in the same RFC (even though “MDTM” was around before being formalized into a RFC).

0reactions
HalfdanJcommented, Aug 20, 2015

I’ve created a simple listMlsd function in my fork here: https://github.com/halfdanj/node-ftp It’s very basic, but is it something you want @mscdex?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is the “created date” incorrect in a SharePoint List or ...
If your dates appear to be wrong in SharePoint or Microsoft Lists there is a good chance that you haven't set the Regional...
Read more >
SharePoint showing incorrect date - Power Platform Community
I have a flow that I am using to create SharePoint list item. I just realized that for some dates SharePoint showing incorrect...
Read more >
Microsoft Lists Date/Time Settings Incorrect - AdamFowlerIT.com
Microsoft Lists Date/Time Settings Incorrect · Browse to office.com and sign in · Click the OneDrive app from the left hand menu ·...
Read more >
Wrong date from SharePoint-List
Hi Community I have a problem with a report. I create a report from a sharepoint list. In the SP-List there is a...
Read more >
Sharepoint List adjusted to Date/Time/Timezone & Using ...
Sharepoint List adjusted to Date/Time/Timezone & Using Locale showing incorrect time. I have a Sharepoint list that captures Start/End times ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found