icetee / node-ftp

An FTP client module for node.js
MIT License
25 stars 16 forks source link

fixed lastMod to interpret MDTM time as GMT #24

Open limikael opened 1 year ago

limikael commented 1 year ago

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.