node-ftp icon indicating copy to clipboard operation
node-ftp copied to clipboard

fixed lastMod to interpret MDTM time as GMT

Open limikael opened this issue 2 years ago • 0 comments

The function lastMod relies on the FTP command MDTM. The MDTM command returns time strings that look like 19990929043300 meaning 1999-09-29 04:33:00. According to RFC 3659 these times are in GMT, which makes sense. However, they were passed directly into the constructor for a Date object, meaning they were interpreted as local time. By adding a Z to the end of the string so it looks like 1999-09-29T04:33:00Z the Date constructor will interpret them correctly.

limikael avatar Feb 23 '23 03:02 limikael