Nine Pedestrians Mesmerized

    @honestfoodcompany/hfc-utility-plugin

    1.0.2 • Public • Published

    #HFC Utility Package

    This package contains all the utility methods used across Honest food company.

    openingHours utility

    Param Description

    1. #####OpeningHourRule { fromDay : Monday, toDay : Firday toHour : 2, fromHour : 10, toMinute : 0, fromMinute : 0, description: Mon-Fri 10:00 - 02:00 }

    Exposed function List

    1. parseOpeningHourRulesForADate

        This function will check if a date falls within an opening rule array or not.
        Will return OpeningHourRule valid for given datetime and the opening hour rule range in which it falls.
        
        @param openingHourRuleArr
        @param dateToCheck momentobject
        @returns { success: boolean, openingHourRuleActive: OpeningHourRule, openingHourRulesValid: OpeningHourRuleArr }
                    success - If successfully parsed the opening hour rule array
                    openingHourRuleActive - If given time falls within a range. Active opening hour rule for given date
                    openingHourRulesValid - Valid opening hour rules for given date
      
    2. helper.updateOpeningHours

       If any opening hour rule has time spanning to next day.
       This function will add an extra opening hours and 
       modify existing one with rule spanning to end of day.
       For Ex. rule Mon-Fri 10:00 - 02:00
       This will be changed to (Mon-Fri 10:00 - 23:59 and Tue-Sat 00:00 - 02:00)
       Others will have no effect
      
       @param - OpeningHourRules
       @returns {any} openingHourRule Arr
      
    3. helper.validateWeekday

       Validate if a given opening hour rule is valid for given date.
       Ex: Given rule - Mon-Fri 10:00 - 02:00, dateToCheck - 2019-03-19
       Will check if a rule is valid for dateToCheck
       
       @param openingHourRule
       @param dateToCheck string in format YYYY-MM-DD
       @returns {boolean}
      

    Keywords

    none

    Install

    npm i @honestfoodcompany/hfc-utility-plugin

    DownloadsWeekly Downloads

    1

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    10.4 kB

    Total Files

    6

    Last publish

    Collaborators

    • ishan123456789
    • hfc-bot
    • rohit-gohri
    • jsander
    • honest_clemens