Skip to content

Issues when building site that uses this plugin on Gatsby #2

@shanejones

Description

@shanejones

I've gone to deploy the site with this plugin on Gatsby. I've traced the error back to this plugin. (the site builds fine when the plugin is commented out)

I'm initialising the date picker with the following.

  const today = new Date()
  const tomorrow = format(add(today, { days: 1 }), "yyyy-MM-dd")

  const localeStrings = { one: "night", other: "nights" }

  <DatePicker
    className="w-full"
    placeholder={checkInDate ? placeHolderDate(checkInDate) : "Select Date"}
    readonly={true}
    minDate={tomorrow}
    onSelect={(date) => {
      setCheckInDate(date);
    }}
    daysLocale={localeStrings}
  />

The full error output is below and it looks to be an issue with date-fns.

Does this plugin need a specific version of date-fns at all?

Building static HTML failed for path "/"

See our docs page for more info on this error: https://gatsby.dev/debug-html


  289 |         return localize.month(month, {
  290 |           width: 'abbreviated',
> 291 |           context: 'standalone'
      | ^
  292 |         });
  293 |       // J, F, ..., D
  294 |


  WebpackError: /Users/shane/sites/static/soulvalley-gatsby/.cache/page-ssr/rout
  es/BookingSearch.js:2769

  - index.js:291
    [subtwo-gatsby]/[date-fns]/esm/_lib/format/formatters/index.js:291:1

  - index.js:339
    [subtwo-gatsby]/[date-fns]/esm/_lib/format/formatters/index.js:339:8

  - index.js:404
    [subtwo-gatsby]/[date-fns]/esm/_lib/format/formatters/index.js:404:1

  - index.js:240
    [subtwo-gatsby]/[date-fns]/esm/_lib/format/formatters/index.js:240:1

  - index.js:80
    [subtwo-gatsby]/[date-fns]/esm/_lib/format/formatters/index.js:80:1

  - index.js:264
    [subtwo-gatsby]/[date-fns]/esm/_lib/format/formatters/index.js:264:1

  - index.js:2
    [subtwo-gatsby]/[date-fns]/esm/_lib/defaultLocale/index.js:2:1

  - require chunk loading:29
    subtwo-gatsby/webpack/runtime/require chunk loading:29:1

  - ensure chunk:6
    subtwo-gatsby/webpack/runtime/ensure chunk:6:1

  - ensure chunk:5
    subtwo-gatsby/webpack/runtime/ensure chunk:5:1

  - PageBuilderHeading.js:15
    subtwo-gatsby/src/components/PageBuilderHeading.js:15:38

  - PageBuilderHeading.js:15
    subtwo-gatsby/src/components/PageBuilderHeading.js:15:31

  - loadable.esm.js:193
    [subtwo-gatsby]/[@loadable]/component/dist/loadable.esm.js:193:1

  - index.js:12
    [subtwo-gatsby]/[date-fns]/esm/locale/en-US/index.js:12:1

  - index.js:18
    [subtwo-gatsby]/[date-fns]/esm/locale/en-US/index.js:18:33
   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions