esoftplay 0.0.217 → 0.0.219

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/moment.ts +12 -0
  2. package/package.json +1 -1
package/moment.ts CHANGED
@@ -67,6 +67,18 @@ export function resetTimeOffset(date: Date, timeZone?: string): Date {
67
67
  return originalTime;
68
68
  }
69
69
 
70
+ export function useLocalTimeChecker(callback?: (valid: boolean) => void): boolean {
71
+ const [isValid, setIsValid] = useSafeState()
72
+ const [compare] = useLocalFormatOnline('YYYY-MM-DD HH:mm:ss')
73
+ useEffect(() => {
74
+ const valid = Math.abs(new Date(compare).getTime() - new Date().getTime()) < 5000
75
+ if (typeof callback == "function")
76
+ callback(valid)
77
+ setIsValid(valid)
78
+ }, [])
79
+ return isValid
80
+ }
81
+
70
82
 
71
83
  export function useLocalFormatOnline(custom): [string, () => void] {
72
84
  const [date, setDate] = useSafeState()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.217",
3
+ "version": "0.0.219",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",