Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Generator/EdifactDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EdifactDate
public const DATETIME_FORMAT = 'YmdHi';

public const SHIPPING_WEEK = 616;
public const SHIPPING_WEEK_FORMAT = 'YW';
public const SHIPPING_WEEK_FORMAT = 'oW';

public const SHIPPING_UNDEFINED = 999;
public const SHIPPING_UNDEFINED_FORMAT = "";
Expand Down
13 changes: 13 additions & 0 deletions tests/GeneratorTest/EdifactDateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,17 @@ public function testParseTimeFormat()
EdifactDate::parseFormat('2018-01-23 10:00', EdifactDate::DATETIME)
);
}

public function testShippingWeekUsesTheWeekYear()
{
// 30 December 2024 is a Monday in ISO week 1 of 2025.
$this->assertEquals(
'202501',
EdifactDate::get('2024-12-30', EdifactDate::SHIPPING_WEEK)
);
$this->assertEquals(
'202001',
EdifactDate::get('2020-01-01', EdifactDate::SHIPPING_WEEK)
);
}
}