Giter Club home page Giter Club logo

dayjs-business-days's People

Contributors

bobbysoar avatar chris-soar avatar conorwatsonsoar avatar dependabot[bot] avatar janesoar avatar paultheurer-soar avatar reediculous456 avatar reedws avatar rfoel avatar superche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dayjs-business-days's Issues

feat: hope to support setting additional working days

Describe the feature you'd like to request

Sometime, there are official additional working days to compensate for the long holiday break. I hope to support setting additional working days, and update isBusinessDay. I think it would be useful.

Use case example.

During Chinese New Year 2023, Chinese official holiday and additional working days are:

  • holiday: from Jan 21 to Jan 27
  • additional working days: Jan 28, Jan 29

ref: https://calendars.icloud.com/holidays/cn_zh.ics

Describe the solution you'd like to see

new API: setAdditionalWorkingDays() => void

Sets the additional working day list to the given array of strings

dayjs.setAdditionalWorkingDays([ `2023-01-28`, `2023-01-29` ]);

update API: isBusinessDay

after setAdditionalWorkingDays

dayjs(`2023-01-28`).isBusinessDay(); // returns true

not working with typescript react

I have a react typescript project I've installed it and tried to use it.

I am getting this when trying to do

dayjs(date).isBusinessDay()

Property 'isBusinessDay' does not exist on type 'Dayjs'.

Not compatible with dayjs `1.11.4`

Getting the following type error when using this plugin version 1.1.1 with dayjs 1.11.4:

Argument of type 'import("/Users/zomars/Sites/cal.com/node_modules/dayjs-business-days2/node_modules/dayjs/index").PluginFunc<unknown>' is not assignable to parameter of type 'import("/Users/zomars/Sites/cal.com/node_modules/dayjs/index").PluginFunc<unknown>'.
  Types of parameters 'c' and 'c' are incompatible.
    Type 'typeof import("/Users/zomars/Sites/cal.com/node_modules/dayjs/index").Dayjs' is not assignable to type 'typeof import("/Users/zomars/Sites/cal.com/node_modules/dayjs-business-days2/node_modules/dayjs/index").Dayjs'.
      Types of construct signatures are incompatible.
        Type 'new (config?: string | number | Dayjs | Date | null | undefined) => Dayjs' is not assignable to type 'new (config?: string | number | Dayjs | Date | null | undefined) => Dayjs'.
          Types of parameters 'config' and 'config' are incompatible.
            Type 'string | number | import("/Users/zomars/Sites/cal.com/node_modules/dayjs-business-days2/node_modules/dayjs/index").Dayjs | Date | null | undefined' is not assignable to type 'string | number | import("/Users/zomars/Sites/cal.com/node_modules/dayjs/index").Dayjs | Date | null | undefined'.
              Type 'Dayjs' is not assignable to type 'string | number | Dayjs | Date | null | undefined'.
                Type 'Dayjs' is missing the following properties from type 'Dayjs': isBetween, isToday, fromNow, from, and 8 more.ts(2345)

image

WARNING in terminal due to 'dayjs-business-days2'

I am using the latest version of dayjs-business-days2 - (version 1.2.0)

I get the below warning in terminal when I run the app with npm start in my react project.

WARNING in ./node_modules/dayjs-business-days2/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:<folder_name><project_name>\node_modules\dayjs-business-days2\src\index.ts' file: Error: ENOENT: no such file or directory, open 'C:<folder_name><project_name>\node_modules\dayjs-business-days2\src\index.ts'

I tried switching to version 1.1.0 and got the same warning.

I do not want to see any error/warning messages when compiling the app. Is this a issue with 'dayjs-business-days2' package?

The isHoliday() does not work

Hi there,

I installed the 'dayjs-business-days2' equal repo GIT but during usage does works well.

_ _ Step by step _ _

import businessDays from 'dayjs-business-days2'

dayjs.extend(businessDays);

const july4th = '2020-07-04'
const options = {
  holidays: [july4th],
  holidayFormat: `YYYY-MM-DD`
};
dayjs.extend(businessDays, options);

But in the Console >> console.log("Date true/false : " + dayjs('2020-07-04T00:00:00.000').isHoliday()); always returns "false".

Can you help me with this please?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.