8000 Feature request: Allow a custom value for now() · Issue #26 · formatjs/intl-relativeformat · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jul 10, 2019. It is now read-only.
This repository was archived by the owner on Jul 10, 2019. It is now read-only.
Feature request: Allow a custom value for now() #26
Closed
@jbaudanza

Description

@jbaudanza

Here are some possible solutions:

  1. Change the signature of format to be format(date, now). now would be optional.
  2. Add a now option to the constructor. This could be either a Date/number constant or a function reference.

My motivation for this request is to use intl-relativeformat from within a React component. I can use this from within React now, but idiomatic React components are supposed to be pure functions of this.props and this.state. Having my render function call Date.now is somewhat of an antipattern.

Let me know what you think. I'd be happy to put together a PR.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0