Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggling of 24-hour format impacts how "requiredInstallationDate" string value is interpreted if your region is set to United Kingdom #478

Closed
bp88 opened this issue Apr 12, 2023 · 5 comments

Comments

@bp88
Copy link

bp88 commented Apr 12, 2023

Curious to see if others are seeing this and able to reproduce this.

We've noticed that in some instances computers are seeing "Days Remaining To Update" set to 0. Our requiredInstallationDate is set to the following which is still in the future:

<key>requiredInstallationDate</key>
<string>2023-04-21T18:00:00</string>

To reproduce:

  1. Go to System Settings > General > Language & Region > Region and set it to "United Kingdom".
  2. Go to System Settings > General > Date & Time > 24-hour time: turn it on (this is the default in the UK)
  3. Launch Nudge. Days Remaining To Update should show up correctly (e.g. 9 days at the time of this comment)
  4. Go to System Settings > General > Date & Time > 24-hour time: turn it off
  5. Re-launch Nudge. Days Remaining To Update shows up incorrectly with 0 days
  6. Go to System Settings > General > Language & Region > Region and set it to "United States".
  7. Re-launch Nudge. Days Remaining To Update shows up incorrectly with 0 days
  8. Go to System Settings > General > Date & Time > 24-hour time: turn it on
  9. Re-launch Nudge. Days Remaining To Update shows up incorrectly with 0 days

Note: I'm not sure why but if your Region is already set to "United States and you simply toggle 24-hour time on and off, you don't see an issue at all. The issue seems to only manifest when you set the region to "United Kingdom". It's possible it may also manifest if you start with other regions as well.

Further investigating reveals the following when you run the command:
defaults read /Library/Managed\ Preferences/com.github.macadmins.Nudge

  • When 24-hour time is disabled: requiredInstallationDate = "2023-04-21 6:00:00 pm +0000";
  • When 24-hour time is enabled: requiredInstallationDate = "2023-04-21 18:00:00 +0000";

If I change the requiredInstallationDate value from a string to a date type, the issue isn't seen:

<key>requiredInstallationDate</key>
<date>2023-04-21T18:00:00Z</date>

Running the following command:
defaults read /Library/Managed\ Preferences/com.github.macadmins.Nudge

  • When 24-hour time is disabled: requiredInstallationDate = "2023-04-21 6:00:00 PM +0000";
  • When 24-hour time is enabled: requiredInstallationDate = "2023-04-21 18:00:00 +0000";

I am aware that there have been updates to documentation that suggest support for string values in #463 but this is a really bizarre issue. Curious to see if other people have seen similar behavior.

Sample Profile:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>userInterface</key>
	<dict>
		<key>fallbackLanguage</key>
		<string>en</string>
		<key>forceFallbackLanguage</key>
		<true/>
		<key>iconDarkPath</key>
		<string>/path/to/image.png</string>
		<key>iconLightPath</key>
		<string>/path/to/image.png</string>
		<key>showDeferralCount</key>
		<true/>
		<key>simpleMode</key>
		<false/>
		<key>singleQuitButton</key>
		<false/>
		<key>updateElements</key>
		<array>
			<dict>
				<key>_language</key>
				<string>en</string>
				<key>actionButtonText</key>
				<string>Update Mac</string>
				<key>customDeferralButtonText</key>
				<string>Custom</string>
				<key>customDeferralDropdownText</key>
				<string>Defer</string>
				<key>informationButtonText</key>
				<string>More Information</string>
				<key>mainContentHeader</key>
				<string>You will need to update your Mac</string>
				<key>mainContentNote</key>
				<string>Friendly reminder from #help</string>
				<key>mainContentSubHeader</key>
				<string>Updates can take around 30-45 minutes to complete</string>
				<key>mainContentText</key>
				<string>There is a software update available for your Mac which needs to be installed. Please click "Update Mac" to initiate the update.\n\nYou may also install this macOS software update at any time by navigating to:\n\nApple menu > System Settings > General > Software Update</string>
				<key>mainHeader</key>
				<string>macOS Update Required</string>
				<key>oneDayDeferralButtonText</key>
				<string>One Day</string>
				<key>oneHourDeferralButtonText</key>
				<string>One Hour</string>
				<key>primaryQuitButtonText</key>
				<string>Update Later</string>
				<key>secondaryQuitButtonText</key>
				<string>I understand</string>
				<key>subHeader</key>
				<string></string>
			</dict>
		</array>
	</dict>
	<key>optionalFeatures</key>
	<dict>
		<key>disableSoftwareUpdateWorkflow</key>
		<true/>
		<key>attemptToFetchMajorUpgrade</key>
		<false/>
		<key>aggressiveUserExperience</key>
		<false/>
		<key>aggressiveUserFullScreenExperience</key>
		<false/>
	</dict>
	<key>osVersionRequirements</key>
	<array>
		<dict>
			<key>aboutUpdateURL</key>
			<string>https://support.apple.com/HT201541</string>
			<key>requiredInstallationDate</key>
			<string>2023-04-21T18:00:00</string>
			<key>requiredMinimumOSVersion</key>
			<string>13.3.1</string>
			<key>targetedOSVersionsRule</key>
			<string>default</string>
		</dict>
	</array>
	<key>userExperience</key>
	<dict>
		<key>randomDelay</key>
		<false/>
		<key>elapsedRefreshCycle</key>
		<string>7200</string>
		<key>imminentRefreshCycle</key>
		<string>7200</string>
	</dict>
</dict>
</plist>
@erikng
Copy link
Member

erikng commented Apr 13, 2023

This ultimately boils down to me having to write conversion code that must be incomplete for strings vs the true object type I first designed Nudge around.

Does it work when you use a json?

@JohankMannen
Copy link

I have the same issue on a users machine. He has the region set to Sweden (that uses 24h as standard) and has the clock set to 12h mode.

We use the Custom json schema in Jamf to make the setup of the configuration profile easy. Is there a way to change that schema to use date instead of string? Tried to manualy change to date in the schema but then it can't read the schema..

@erikng
Copy link
Member

erikng commented Apr 4, 2024

Nope. JAMF json schema doesn't support date only string. Because of jamf's limitations I had to write special code.

If you need to handle this, you need to deploy a custom mdm profile that doesn't have jamf's limitations.

@federicojolytrainline
Copy link

I had at least 2 users with time zone set to UK but time format not 24h.
I just moved from a custom schema CP to a plain XML one, to change the tags from to .

@erikng
Copy link
Member

erikng commented Jul 2, 2024

I'm pretty sure I've resolved this issue by adding proper support for local installation times. Remove the Z and try on Nudge 2.0. Closing this.

@erikng erikng closed this as completed by moving to Done in Nudge 2.0 Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants