Skip to content

Custom string when instantiating  #179

Open
@iamvanja

Description

Is something like this not possible?

const d = spacetime(
  '12/30/19 12:22:08 PM', // pass unix format for spacetime to understand how to parse this value in options?
  'Pacific/Honolulu',
  { silent: false } // format: 'MM/dd/yy hh:mm:ss a'
);

Expected to get a datetime instance of this date/time in Hawaii, but instead

d.isValid(); // false
d.unxFmt('MM/dd/yy hh:mm:ss a'); // 12/31/69 02:00:00 PM

Also, in TS, { silent: false } fails because weekStart is required. Is this by design?
Furthermore, dmy field is mentioned as an option in the README, but it is not part of the type definitions?

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions