diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cb92a6..1218b63 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
+## [1.3.1] - 16-10-2026
+
+### Changed
+
+- Fixed start and end date so night shifts end on the day after the roster date.
+
## [1.3.0] - 09-06-2026
### Changed
diff --git a/README.md b/README.md
index 74abbcf..0562720 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,7 @@ The following settings are required to connect to the API.
| BaseUrl | The URL to the API | Yes |
| HistoricalDays | - The number of days in the past from which the shifts will be imported.
- Will be converted to a `[DateTime]` object containing the _current date_ __minus__ the number of days specified. | Yes |
| FutureDays | - The number of days in the future from which the shifts will be imported.
- Will be converted to a `[DateTime]` object containing the _current date_ __plus__ the number of days specified. | Yes |
+| ExcludeShiftsWithoutFunction | - When enabled, shifts without a function will not be imported. This prevents importing days off. | No |
### Remarks
diff --git a/configuration.json b/configuration.json
index e52d49e..7f9d318 100644
--- a/configuration.json
+++ b/configuration.json
@@ -49,5 +49,14 @@
"description": "The number of days in the future from which the shifts will be imported.",
"required": true
}
+ },
+ {
+ "key": "ExcludeShiftsWithoutFunction",
+ "type": "checkbox",
+ "defaultValue": false,
+ "templateOptions": {
+ "label": "Exclude shifts without function",
+ "required": false
+ }
}
-]
+]
\ No newline at end of file
diff --git a/persons.ps1 b/persons.ps1
index 492bc72..aada18c 100644
--- a/persons.ps1
+++ b/persons.ps1
@@ -15,6 +15,7 @@ $Script:AuthenticationHeaders = $null
$Script:BaseUrl = $config.BaseUrl
$Script:Username = $config.Username
$Script:Password = $config.Password
+$Script:ExcludeShiftsWithoutFunction = $config.ExcludeShiftsWithoutFunction
#region functions
function Resolve-IntusInplanningError {
@@ -300,6 +301,7 @@ try {
if ((-not($day.parts.count -eq 0)) -and ($null -eq $day.absence)) {
$rosterDate = $day.rosterDate
+ $rosterEndDate = $rosterDate
foreach ($part in $day.parts) {
$counter = $counter + 1
@@ -310,13 +312,9 @@ try {
$pattern = '^\d{2}:\d{2}-\d{2}:\d{2}'
$time = [regex]::Match($part.shift.uname, $pattern)
if ($time.Success) {
- $times = $time.value -split '-'
- $startTime = $times[0]
- $endTime = $times[1]
- }
- else {
- $startTime = '00:00'
- $endTime = '00:00'
+ if($part.shift.uname.EndsWith('p')){
+ $rosterEndDate = ([datetime]$rosterDate).AddDays(1).ToString("yyyy-MM-dd")
+ }
}
}
else {
@@ -324,16 +322,9 @@ try {
$pattern = '^\d{4}-\d{4}'
$time = [regex]::Match($part.shift.uname, $pattern)
if ($time.Success) {
- $times = $time.value -split '-'
- $startTimeUnformatted = $times[0]
- $endTimeUnformatted = $times[1]
- # Format HHMM to HH:MM
- $startTime = "$($startTimeUnformatted.Substring(0, 2)):$($startTimeUnformatted.Substring(2, 2))"
- $endTime = "$($endTimeUnformatted.Substring(0, 2)):$($endTimeUnformatted.Substring(2, 2))"
- }
- else {
- $startTime = '00:00'
- $endTime = '00:00'
+ if($part.shift.uname.EndsWith('p')){
+ $rosterEndDate = ([datetime]$rosterDate).AddDays(1).ToString("yyyy-MM-dd")
+ }
}
}
@@ -344,7 +335,10 @@ try {
else {
$functioncode = ""
$function = ""
- # break # If you want to skip shifts without a function, you can uncomment this line.
+
+ if($Script:ExcludeShiftsWithoutFunction){
+ break
+ }
}
$groupExternalId = $part.group.externalId
@@ -364,8 +358,8 @@ try {
# Add the same fields as for shift. Otherwise, the HelloID mapping will fail
# The value of both the 'startAt' and 'endAt' cannot be null. If empty, HelloID is unable
# to determine the start/end date, resulting in the contract marked as 'active'.
- startAt = "$($rosterDate)T$($startTime):00Z"
- endAt = "$($rosterDate)T$($endTime):00Z"
+ startAt = "$($rosterDate)"
+ endAt = "$($rosterEndDate)"
}
$contracts.Add($ShiftContract)