spencermountain / spacetime

A lightweight javascript timezone library
http://spacetime.how/
Other
3.97k stars 184 forks source link

Unable to chain .i18n() with .format() methods #372

Closed vresetnikov closed 1 year ago

vresetnikov commented 1 year ago

Hello, for some reason I am not able to do the following:

const assignmentDate = spacetime("2022-11-21T00:00:00.000Z").i18n(i18nConfig).format("{day-short}, {month-short}, {date}, {year}");

I receive the following error:

Cannot read properties of undefined (reading 'format')

Not sure if this is intended. The following functions as a workaround:

    const assignmentDate = spacetime("2022-11-21T00:00:00.000Z");
    assignmentDate.i18n(i18nConfig);
    const formattedAssignmentDate = assignmentDate.format(
      "{day-short}, {month-short}, {date}, {year}"
    );
spencermountain commented 1 year ago

good catch, fixed in 7.4.2 cheers!