Giter Site home page Giter Site logo

codaamok / psbusinesstime Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 1.0 86 KB

A PowerShell module with functions to help calculate working hours, and for generally working with or calculating business hours / date times.

License: GNU General Public License v3.0

PowerShell 100.00%
business-hours business-ti calendar dates datetime powershell time working-days working-hours working-time

psbusinesstime's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Iโ€™m currently working on nothing open-source related, but a few projects at work which consume time!
  • ๐ŸŒฑ Iโ€™m currently learning mongodb
  • ๐Ÿค” Iโ€™m looking for help with learning more about mongodb
  • ๐Ÿ’ฌ Ask me about PowerShell, Azure, Linux, ConfigMgr (SCCM/MEMCM/MECM)
  • ๐Ÿ“ซ How to reach me: Twitter
  • ๐Ÿ˜„ Pronouns: he/him
  • โšก Fun fact: I have a Beagle named Alfie - send help ๐Ÿ†˜

psbusinesstime's People

Contributors

actions-user avatar codaamok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

taxitorloseit

psbusinesstime's Issues

Method invocation failed because [System.TimeSpan] does not contain a method named 'op_Multiply'.

Environment

Name                      Value                  
----                      -----                  
PSVersion                 5.1.19041.1682         
PSEdition                 Desktop                
PSCompatibleVersions      {1.0, 2.0, 3.0, 4.0...}
BuildVersion              10.0.19041.1682        
CLRVersion                4.0.30319.42000        
WSManStackVersion         3.0                    
PSRemotingProtocolVersion 2.3                    
SerializationVersion      1.1.0.1                

Current (as of 0.3.0)

Input

New-BusinessTimeSpan -Start (Get-Date '2022-04-01 00:00:00') -End (Get-Date '2022-04-30 23:59:59') -NonWorkingDates (Get-Date '2022-04-15'), (Get-Date '2022-04-18')

Output

Method invocation failed because [System.TimeSpan] does not contain a method named 'op_Multiply'.
At C:\Users\...\Documents\WindowsPowerShell\Modules\PSBusinessTime\0.3.0\PSBusinessTime.psm1:409 char:9
+         $InBetweenHours = $NumberOfWorkingDays * $WorkingHours
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Multiply:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Workaround

Patch

PSBusinessTime.psm1
Line 313

From:

$WorkingHours = New-TimeSpan -Start $StartHour -End $FinishHour

To:

$WorkingHours = (New-TimeSpan -Start $StartHour -End $FinishHour).TotalHours

PSBusinessTime.psm1
Line 409

From:

$InBetweenHours = $NumberOfWorkingDays * $WorkingHours

To:

$InBetweenHours = New-TimeSpan -Hours ($NumberOfWorkingDays * $WorkingHours)

Input

New-BusinessTimeSpan -Start (Get-Date '2022-04-01 00:00:00') -End (Get-Date '2022-04-30 23:59:59') -NonWorkingDates (Get-Date '2022-04-15'), (Get-Date '2022-04-18')

Output

Days              : 7
Hours             : 3
Minutes           : 0
Seconds           : 0
Milliseconds      : 0
Ticks             : 6156000000000
TotalDays         : 7.125
TotalHours        : 171
TotalMinutes      : 10260
TotalSeconds      : 615600
TotalMilliseconds : 615600000

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.