README.md (3155B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # minutesInMonth 22 23 > Determine the number of minutes in a month. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var minutesInMonth = require( '@stdlib/time/minutes-in-month' ); 31 ``` 32 33 #### minutesInMonth( \[month\[, year]] ) 34 35 Returns the number of minutes in a month. 36 37 ```javascript 38 var num = minutesInMonth(); 39 // returns <number> 40 ``` 41 42 By default, the function returns the number of minutes in the current month of the current year (according to local time). To determine the number of minutes for a particular month and year, provide `month` and `year` arguments. 43 44 ```javascript 45 var num = minutesInMonth( 2 ); 46 // returns <number> 47 48 num = minutesInMonth( 2, 2016 ); 49 // returns 41760 50 51 num = minutesInMonth( 2, 2017 ); 52 // returns 40320 53 ``` 54 55 A `month` may be either a month's integer value, three letter abbreviation, or full name (case insensitive). 56 57 ```javascript 58 var num = minutesInMonth( 2, 2016 ); 59 // returns 41760 60 61 num = minutesInMonth( 'feb', 2016 ); 62 // returns 41760 63 64 num = minutesInMonth( 'february', 2016 ); 65 // returns 41760 66 ``` 67 68 The function also supports providing a [`Date`][date-object] object. 69 70 ```javascript 71 var num = minutesInMonth( new Date() ); 72 // returns <number> 73 ``` 74 75 </section> 76 77 <!-- /.usage --> 78 79 <section class="notes"> 80 81 ## Notes 82 83 - The function's return value is a generalization and does **not** take into account inaccuracies due to daylight savings conventions, crossing timezones, or other complications with time and dates. 84 85 </section> 86 87 <!-- /.notes --> 88 89 <section class="examples"> 90 91 ## Examples 92 93 <!-- eslint no-undef: "error" --> 94 95 ```javascript 96 var minutesInMonth = require( '@stdlib/time/minutes-in-month' ); 97 98 var v; 99 var i; 100 101 for ( i = 0; i < 2021; i++ ) { 102 v = minutesInMonth( 'feb', i ); 103 console.log( 'In the year %d, February has %d minutes.', i, v ); 104 } 105 ``` 106 107 </section> 108 109 <!-- /.examples --> 110 111 * * * 112 113 <section class="cli"> 114 115 ## CLI 116 117 <section class="usage"> 118 119 ### Usage 120 121 ```text 122 Usage: minutes-in-month [options] [month] [year] 123 124 Options: 125 126 -h, --help Print this message. 127 -V, --version Print the package version. 128 ``` 129 130 </section> 131 132 <!-- /.usage --> 133 134 <section class="examples"> 135 136 ### Examples 137 138 ```bash 139 $ minutes-in-month 140 <number> 141 ``` 142 143 For a specific month, 144 145 ```bash 146 $ minutes-in-month 2 147 <number> 148 ``` 149 150 For a specific month and year, 151 152 ```bash 153 $ minutes-in-month 2 2016 154 41760 155 ``` 156 157 </section> 158 159 <!-- /.examples --> 160 161 </section> 162 163 <!-- /.cli --> 164 165 <section class="links"> 166 167 [date-object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date 168 169 </section> 170 171 <!-- /.links -->