Skip to content

setNow

resolvers
Source Code | Documentation

See also: resolvers/resolveData resolvers/resolveResult resolvers/resolveQuery

Returns a resolver property that sets the field to the current timestamp (Date.now()). Always overwrites the existing value.

ts
  import {  } from 'feathers-utils/resolvers';

Example

ts
import { resolveData, setNow } from 'feathers-utils/resolvers'

resolveData({
  createdAt: setNow(),
})

Type declaration

Show Type Declarations
ts
/**
 * Returns a resolver property that sets the field to the current timestamp
 * (`Date.now()`). Always overwrites the existing value.
 *
 * @example
 * ```ts
 *
 *
 * resolveData({
 *   createdAt: setNow(),
 * })
 * ```
 */
export declare function setNow<H extends HookContext = HookContext>(
  condition?: ResolverCondition<H>,
): (options: ResolverPropertyOptions<any, any, H>) => any
ArgumentTypeDescription
conditionResolverCondition<H>

Released under the MIT License.