{"_id":"@chancn/capacitor-date-and-time-settings","_rev":"3-18159bc5349508d473b59153b101ff2a","name":"@chancn/capacitor-date-and-time-settings","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@chancn/capacitor-date-and-time-settings","version":"0.0.1","keywords":["capacitor","plugin","native"],"author":{"name":"chancn"},"license":"MIT","_id":"@chancn/capacitor-date-and-time-settings@0.0.1","maintainers":[{"name":"chancn","email":"chancn.dev@gmail.com"}],"homepage":"https://github.com/chancn38/capacitor-date-and-time-settings#readme","bugs":{"url":"https://github.com/chancn38/capacitor-date-and-time-settings/issues"},"dist":{"shasum":"2cb0b76bb7e4dcfc8851d71fefd96ac1510cf231","tarball":"https://registry.npmjs.org/@chancn/capacitor-date-and-time-settings/-/capacitor-date-and-time-settings-0.0.1.tgz","fileCount":26,"integrity":"sha512-kNu4CD2W/LYSHngb2KZ6wP6ZEBGdb2cfGpR3GOSF+bIR0gAlNGTGNz/K8nO17YsLOZWqdiTeqqrZLRcLIMH25Q==","signatures":[{"sig":"MEUCIHeeyEtE0Y3LnTLbFav81Z8ckPhp6pRev+1LnKOj/c0vAiEA4YaTSrbVRfpZmWwtvxgN2i3crAKHs5BTAJVPZLjvdnk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17694},"main":"dist/plugin.cjs.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","module":"dist/esm/index.js","gitHead":"258aa99a878f18618e8e48dbd1326c4a28aa59bd","scripts":{"fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","docgen":"docgen --api DateAndTimeSettingsPlugin --output-readme README.md --output-json dist/docs.json","eslint":"eslint . --ext ts","verify":"npm run verify:ios && npm run verify:android && npm run verify:web","prettier":"prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java","swiftlint":"node-swiftlint","verify:ios":"xcodebuild -scheme CapacitorDateAndTimeSettings -destination generic/platform=iOS","verify:web":"npm run build","prepublishOnly":"npm run build","verify:android":"cd android && ./gradlew clean build test && cd .."},"_npmUser":{"name":"chancn","email":"chancn.dev@gmail.com"},"prettier":"@ionic/prettier-config","capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"swiftlint":"@ionic/swiftlint-config","repository":{"url":"git+https://github.com/chancn38/capacitor-date-and-time-settings.git","type":"git"},"_npmVersion":"10.2.4","description":"This Capacitor plugin checks if automatic date and time settings are enabled. If disabled, it displays a user-friendly alert, ensuring your application relies on accurate time information.","directories":{},"_nodeVersion":"21.5.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","rimraf":"^6.1.0","rollup":"^4.53.2","prettier":"^3.6.2","swiftlint":"^2.0.0","typescript":"^5.9.3","@capacitor/ios":"^8.0.0","@capacitor/core":"^8.0.0","@capacitor/docgen":"^0.3.1","@capacitor/android":"^8.0.0","@ionic/eslint-config":"^0.4.0","prettier-plugin-java":"^2.7.7","@ionic/prettier-config":"^4.0.0","@ionic/swiftlint-config":"^2.0.0"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/capacitor-date-and-time-settings_0.0.1_1769060065016_0.756041228760252","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@chancn/capacitor-date-and-time-settings","version":"0.0.2","keywords":["capacitor","plugin","native"],"author":{"name":"chancn"},"license":"MIT","_id":"@chancn/capacitor-date-and-time-settings@0.0.2","maintainers":[{"name":"chancn","email":"chancn.dev@gmail.com"}],"homepage":"https://github.com/chancn38/capacitor-date-and-time-settings#readme","bugs":{"url":"https://github.com/chancn38/capacitor-date-and-time-settings/issues"},"dist":{"shasum":"24f549f49b4259c15e1e4fd5e7aa42c41f3653a5","tarball":"https://registry.npmjs.org/@chancn/capacitor-date-and-time-settings/-/capacitor-date-and-time-settings-0.0.2.tgz","fileCount":26,"integrity":"sha512-bWR2pBz5Ym7zE3n1Zt9PKc7dXcOjHj9DUKJ/o1QUHgA9Ip52WN8S0mK4uYDTWacO31IYRh14GlWljBBauR7OGQ==","signatures":[{"sig":"MEQCIF3qTA/RdJ+TQB6L5n6oHJWwEgUDcHndpBdzl5coGmpMAiAVOt48J580l7j/oRUJKWHPM8C13cDHqh17/vUpWaDkwg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23925},"main":"dist/plugin.cjs.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","module":"dist/esm/index.js","gitHead":"9dbf68f183ea3391862b309f946ac27c8df339a2","scripts":{"fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","docgen":"docgen --api DateAndTimeSettingsPlugin --output-readme README.md --output-json dist/docs.json","eslint":"eslint . --ext ts","verify":"npm run verify:ios && npm run verify:android && npm run verify:web","prettier":"prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java","swiftlint":"node-swiftlint","verify:ios":"xcodebuild -scheme CapacitorDateAndTimeSettings -destination generic/platform=iOS","verify:web":"npm run build","prepublishOnly":"npm run build","verify:android":"cd android && ./gradlew clean build test && cd .."},"_npmUser":{"name":"chancn","email":"chancn.dev@gmail.com"},"prettier":"@ionic/prettier-config","capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"swiftlint":"@ionic/swiftlint-config","repository":{"url":"git+https://github.com/chancn38/capacitor-date-and-time-settings.git","type":"git"},"_npmVersion":"10.2.4","description":"This Capacitor plugin checks if automatic date and time settings are enabled. If disabled, it displays a user-friendly alert, ensuring your application relies on accurate time information.","directories":{},"_nodeVersion":"21.5.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","rimraf":"^6.1.0","rollup":"^4.53.2","prettier":"^3.6.2","swiftlint":"^2.0.0","typescript":"^5.9.3","@capacitor/ios":"^8.0.0","@capacitor/core":"^8.0.0","@capacitor/docgen":"^0.3.1","@capacitor/android":"^8.0.0","@ionic/eslint-config":"^0.4.0","prettier-plugin-java":"^2.7.7","@ionic/prettier-config":"^4.0.0","@ionic/swiftlint-config":"^2.0.0"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/capacitor-date-and-time-settings_0.0.2_1769062089365_0.16387350886139873","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@chancn/capacitor-date-and-time-settings","version":"0.0.3","description":"This Capacitor plugin checks if automatic date and time settings are enabled. If disabled, it displays a user-friendly alert, ensuring your application relies on accurate time information.","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"chancn"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/chancn38/capacitor-date-and-time-settings.git"},"bugs":{"url":"https://github.com/chancn38/capacitor-date-and-time-settings/issues"},"keywords":["capacitor","plugin","native"],"scripts":{"verify":"npm run verify:ios && npm run verify:android && npm run verify:web","verify:ios":"xcodebuild -scheme CapacitorDateAndTimeSettings -destination generic/platform=iOS","verify:android":"cd android && ./gradlew clean build test && cd ..","verify:web":"npm run build","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","eslint":"eslint . --ext ts","prettier":"prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java","swiftlint":"node-swiftlint","docgen":"docgen --api DateAndTimeSettingsPlugin --output-readme README.md --output-json dist/docs.json","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"devDependencies":{"@capacitor/android":"^8.0.0","@capacitor/core":"^8.0.0","@capacitor/docgen":"^0.3.1","@capacitor/ios":"^8.0.0","@ionic/eslint-config":"^0.4.0","@ionic/prettier-config":"^4.0.0","@ionic/swiftlint-config":"^2.0.0","eslint":"^8.57.1","prettier":"^3.6.2","prettier-plugin-java":"^2.7.7","rimraf":"^6.1.0","rollup":"^4.53.2","swiftlint":"^2.0.0","typescript":"^5.9.3"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"prettier":"@ionic/prettier-config","swiftlint":"@ionic/swiftlint-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"_id":"@chancn/capacitor-date-and-time-settings@0.0.3","gitHead":"8ab038d4989196ceb7a2e0d45069e23470192699","homepage":"https://github.com/chancn38/capacitor-date-and-time-settings#readme","_nodeVersion":"21.5.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-QXZezHE72c30FeWGHVpkCeiv4XCgNwYBqYWhL+OKpaaYCavV446vCn9iPJiefFZ9KmQi/Ey8yJM7H1v8R+VQvg==","shasum":"3aa362f529cb7d4d1f460339e194187e7cc748cf","tarball":"https://registry.npmjs.org/@chancn/capacitor-date-and-time-settings/-/capacitor-date-and-time-settings-0.0.3.tgz","fileCount":26,"unpackedSize":26924,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCChzPpStSKPos9ulszuwW7toUBSuLqlBje0ebiY4/nCQIhAIEwEkl4O++jfhFLZ4sZtRjZ8/ucFgD2QFQofxEFZeOQ"}]},"_npmUser":{"name":"chancn","email":"chancn.dev@gmail.com"},"directories":{},"maintainers":[{"name":"chancn","email":"chancn.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/capacitor-date-and-time-settings_0.0.3_1769074023761_0.9892064122778272"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-22T05:34:24.956Z","modified":"2026-01-22T09:27:04.216Z","0.0.1":"2026-01-22T05:34:25.158Z","0.0.2":"2026-01-22T06:08:09.626Z","0.0.3":"2026-01-22T09:27:04.092Z"},"bugs":{"url":"https://github.com/chancn38/capacitor-date-and-time-settings/issues"},"author":{"name":"chancn"},"license":"MIT","homepage":"https://github.com/chancn38/capacitor-date-and-time-settings#readme","keywords":["capacitor","plugin","native"],"repository":{"type":"git","url":"git+https://github.com/chancn38/capacitor-date-and-time-settings.git"},"description":"This Capacitor plugin checks if automatic date and time settings are enabled. If disabled, it displays a user-friendly alert, ensuring your application relies on accurate time information.","maintainers":[{"name":"chancn","email":"chancn.dev@gmail.com"}],"readme":"# @chancn/capacitor-date-and-time-settings\r\n\r\n[![npm version](https://img.shields.io/npm/v/@chancn/capacitor-date-and-time-settings)](https://www.npmjs.com/package/@chancn/capacitor-date-and-time-settings)\r\n[![license](https://img.shields.io/npm/l/@chancn/capacitor-date-and-time-settings)](LICENSE)\r\n\r\nA **Capacitor plugin (Android only)** to check whether automatic date & time and timezone settings are enabled on a device, and to open the device's Date & Time settings page.\r\n\r\n---\r\n\r\n## 📦 Installation\r\n\r\n```bash\r\nnpm install @chancn/capacitor-date-and-time-settings\r\nnpx cap sync\r\n```\r\n\r\n---\r\n\r\n## 🔌 Register the Plugin\r\n\r\n```ts\r\nimport { registerPlugin } from '@capacitor/core';\r\n\r\nexport interface AutoTimePlugin {\r\n  isAutoDateTimeEnabled(): Promise<{ enabled: boolean }>;\r\n  isAutoTimeZoneEnabled(): Promise<{ enabled: boolean }>;\r\n  getCurrentTimeZone(): Promise<{ timeZone: string }>;\r\n  isTimeZoneCorrect(options: { expectedZoneId: string }): Promise<{ \r\n    isCorrect: boolean; \r\n    currentZone: string; \r\n  }>;\r\n  openDateTimeSettings(): Promise<void>;\r\n}\r\n\r\nexport const AutoTime = registerPlugin<AutoTimePlugin>('AutoTime');\r\n```\r\n\r\n---\r\n\r\n## ⚡ Usage in React/Ionic (Android Only)\r\n\r\n```tsx\r\nimport React, { useEffect, useState } from 'react';\r\nimport { IonButton, IonContent, IonPage } from '@ionic/react';\r\nimport { AutoTime } from '@chancn/capacitor-date-and-time-settings';\r\nimport { toaster } from 'your-toaster-lib'; // Replace with your toaster implementation\r\n\r\nconst EXPECTED_TIMEZONE = 'Asia/Manila';\r\n\r\nconst DateTimeScreen: React.FC = () => {\r\n  const [isTimeSettingsValid, setIsTimeSettingsValid] = useState(true);\r\n  const [timeSettingsMessage, setTimeSettingsMessage] = useState('');\r\n  const [isCheckingSettings, setIsCheckingSettings] = useState(false);\r\n\r\n  const openDeviceSettings = async () => {\r\n    try {\r\n      await AutoTime.openDateTimeSettings();\r\n      toaster.success('Opening Date & Time settings...');\r\n\r\n      setTimeout(async () => {\r\n        await recheckTimeSettings();\r\n      }, 2000);\r\n    } catch (error) {\r\n      console.error('Error opening settings:', error);\r\n      toaster.warning('Please manually open Settings > Date & Time');\r\n    }\r\n  };\r\n\r\n  const recheckTimeSettings = async () => {\r\n    setIsCheckingSettings(true);\r\n    try {\r\n      const autoDate = await AutoTime.isAutoDateTimeEnabled();\r\n      const autoZone = await AutoTime.isAutoTimeZoneEnabled();\r\n      const timezone = await AutoTime.getCurrentTimeZone();\r\n\r\n      const missingSettings: string[] = [];\r\n      if (!autoDate.enabled) missingSettings.push('Automatic Date & Time');\r\n      if (!autoZone.enabled) missingSettings.push('Automatic Time Zone');\r\n      if (EXPECTED_TIMEZONE && timezone.timeZone !== EXPECTED_TIMEZONE) {\r\n        missingSettings.push(`Correct Timezone (should be ${EXPECTED_TIMEZONE})`);\r\n      }\r\n\r\n      if (missingSettings.length > 0) {\r\n        setIsTimeSettingsValid(false);\r\n        setTimeSettingsMessage(`Please enable: ${missingSettings.join(', ')}`);\r\n        toaster.warning('Settings still need to be configured');\r\n      } else {\r\n        setIsTimeSettingsValid(true);\r\n        setTimeSettingsMessage('');\r\n        toaster.success('Time settings verified! You can now punch in/out.');\r\n      }\r\n    } catch (error) {\r\n      console.error('Error rechecking time settings:', error);\r\n      toaster.danger('Unable to verify settings. Please try again.');\r\n    } finally {\r\n      setIsCheckingSettings(false);\r\n    }\r\n  };\r\n\r\n  useEffect(() => {\r\n    const checkTimeSettings = async () => {\r\n      setIsCheckingSettings(true);\r\n      try {\r\n        const autoDate = await AutoTime.isAutoDateTimeEnabled();\r\n        const autoZone = await AutoTime.isAutoTimeZoneEnabled();\r\n        const timezone = await AutoTime.getCurrentTimeZone();\r\n\r\n        const missingSettings: string[] = [];\r\n        if (!autoDate.enabled) missingSettings.push('Automatic Date & Time');\r\n        if (!autoZone.enabled) missingSettings.push('Automatic Time Zone');\r\n        if (EXPECTED_TIMEZONE && timezone.timeZone !== EXPECTED_TIMEZONE) {\r\n          missingSettings.push(`Correct Timezone (should be ${EXPECTED_TIMEZONE})`);\r\n        }\r\n\r\n        if (missingSettings.length > 0) {\r\n          setIsTimeSettingsValid(false);\r\n          setTimeSettingsMessage(`Please enable: ${missingSettings.join(', ')}`);\r\n        } else {\r\n          setIsTimeSettingsValid(true);\r\n          setTimeSettingsMessage('');\r\n        }\r\n      } catch (error) {\r\n        console.error('Error checking time settings:', error);\r\n        setIsTimeSettingsValid(false);\r\n        setTimeSettingsMessage('Unable to verify time settings');\r\n      } finally {\r\n        setIsCheckingSettings(false);\r\n      }\r\n    };\r\n\r\n    checkTimeSettings();\r\n\r\n    const handleAppResume = () => {\r\n      recheckTimeSettings();\r\n    };\r\n\r\n    document.addEventListener('resume', handleAppResume);\r\n    window.addEventListener('focus', handleAppResume);\r\n\r\n    return () => {\r\n      document.removeEventListener('resume', handleAppResume);\r\n      window.removeEventListener('focus', handleAppResume);\r\n    };\r\n  }, []);\r\n\r\n  return (\r\n    <IonPage>\r\n      <IonContent className=\"ion-padding\">\r\n        <IonButton onClick={openDeviceSettings} disabled={isCheckingSettings}>\r\n          Open Date & Time Settings\r\n        </IonButton>\r\n\r\n        <div style={{ marginTop: 20 }}>\r\n          {isCheckingSettings ? 'Checking...' : timeSettingsMessage}\r\n        </div>\r\n\r\n        {isTimeSettingsValid && <div>✅ Time settings are correct!</div>}\r\n      </IonContent>\r\n    </IonPage>\r\n  );\r\n};\r\n\r\nexport default DateTimeScreen;\r\n```\r\n\r\n---\r\n\r\n## ✅ Plugin Methods (Android Only)\r\n\r\n| Method | Description |\r\n|--------|------------|\r\n| `isAutoDateTimeEnabled()` | Checks if **Automatic Date & Time** is enabled. |\r\n| `isAutoTimeZoneEnabled()` | Checks if **Automatic Time Zone** is enabled. |\r\n| `getCurrentTimeZone()` | Returns the device's **current timezone**. |\r\n| `isTimeZoneCorrect({ expectedZoneId })` | Checks if the current timezone matches the expected one. |\r\n| `openDateTimeSettings()` | Opens the device's **Date & Time settings** page. |\r\n\r\n---\r\n\r\n## ⚠️ Notes\r\n\r\n- Works **only on Android devices**. iOS is not supported yet.\r\n- Always run `npx cap sync` after installing or updating the plugin.\r\n- Can be integrated with modals, alerts, or toasters to guide users to enable correct settings.\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT","readmeFilename":"README.md"}