MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / useDate

Function useDate

react/src/hooks.ts:427–443  ·  view source on GitHub ↗
(
  resource: Resource,
  propertyURL: string,
  opts?: useValueOptions,
)

Source from the content-addressed store, hash-verified

425 * component. See {@link useValue}
426 */
427export function useDate(
428 resource: Resource,
429 propertyURL: string,
430 opts?: useValueOptions,
431): Date | null {
432 const store = useStore();
433 const [value] = useValue(resource, propertyURL, opts);
434 if (value == null) {
435 return null;
436 }
437 try {
438 return valToDate(value);
439 } catch (e) {
440 store.handleError(e);
441 return null;
442 }
443}
444
445/** Preffered way of using the store in a Component or Hook */
446export function useStore(): Store {

Callers

nothing calls this directly

Calls 4

valToDateFunction · 0.90
useStoreFunction · 0.85
useValueFunction · 0.85
handleErrorMethod · 0.80

Tested by

no test coverage detected