Skip to content

Commit

Permalink
fix:ms-dos date format (#84)
Browse files Browse the repository at this point in the history
* fix:ms-dos date format

* fix:ms-dos date format

---------

Co-authored-by: veeso <christian.visintin@veeso.dev>
  • Loading branch information
ZLATAN628 and veeso committed May 24, 2024
1 parent a99b742 commit 6ff024d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

- [Changelog](#changelog)
- [6.0.1](#601)
- [6.0.0](#600)
- [5.4.0](#540)
- [5.3.1](#531)
Expand Down Expand Up @@ -33,6 +34,12 @@

---

## 6.0.1

Released on 24/05/2024

- [PR 84](https://github.com/veeso/suppaftp/pull/84): LIST with DOS lines parsed `%d-%m` but the correct syntax is `%m-%d`

## 6.0.0

Released on 20/05/2024
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["suppaftp", "suppaftp-cli"]
resolver = "2"

[workspace.package]
version = "6.0.0"
version = "6.0.1"
edition = "2021"
authors = [
"Christian Visintin <christian.visintin@veeso.dev>",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>

<p align="center">Developed by <a href="https://veeso.github.io/">veeso</a> and <a href="https://github.com/mattnenterprise">Matt McCoy</a></p>
<p align="center">Current version: 6.0.0 (20/05/2024)</p>
<p align="center">Current version: 6.0.1 (24/05/2024)</p>

<p align="center">
<a href="https://opensource.org/licenses/MIT"
Expand Down
10 changes: 5 additions & 5 deletions suppaftp/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ impl File {
.unwrap_or(SystemTime::UNIX_EPOCH))
}

/// Parse date time string in DOS representation ("%d-%m-%y %I:%M%p")
/// Parse date time string in DOS representation ("%m-%d-%y %I:%M%p")
fn parse_dostime(tm: &str) -> Result<SystemTime, ParseError> {
NaiveDateTime::parse_from_str(tm, "%d-%m-%y %I:%M%p")
NaiveDateTime::parse_from_str(tm, "%m-%d-%y %I:%M%p")
.map(|dt| {
SystemTime::UNIX_EPOCH
.checked_add(Duration::from_secs(dt.and_utc().timestamp() as u64))
Expand Down Expand Up @@ -810,7 +810,7 @@ mod test {
.duration_since(SystemTime::UNIX_EPOCH)
.ok()
.unwrap(),
Duration::from_secs(1407164940)
Duration::from_secs(1396969740)
);
// Parse directory
let dir: File = File::try_from("04-08-14 03:09PM <DIR> docs")
Expand All @@ -834,7 +834,7 @@ mod test {
.duration_since(SystemTime::UNIX_EPOCH)
.ok()
.unwrap(),
Duration::from_secs(1407164940)
Duration::from_secs(1396969740)
);
// Error
assert_eq!(
Expand Down Expand Up @@ -942,7 +942,7 @@ mod test {
.duration_since(SystemTime::UNIX_EPOCH)
.ok()
.unwrap(),
Duration::from_secs(1407164940)
Duration::from_secs(1396969740)
);
// Not enough argument for datetime
assert!(File::parse_dostime("04-08-14").is_err());
Expand Down

0 comments on commit 6ff024d

Please sign in to comment.