Releases: TerenceJefferies/STime
Releases · TerenceJefferies/STime
Bug fixes
Fix security vulnerabilities
This version includes a number of security vulnerability fixes.
Add parse option
- Add
parseoption to main API, you can now parse strings into time instances.
Add create from now builder
Create from now builder is a new feature that allows you to create a new time from the current time or a specified time. More can be read about this feature in the README or docs sections.
- Create from now builder added
yesterdaymethod addedtomorrowmethod added
Add difference system
- Add difference system to get the difference between two times.
stime.difference(timeOne, timeTwo);
Difference options
Difference.getTotalSeconds()Difference.getTotalMinutes()Difference.getTotalHours()Difference.getTotalDays()Difference.getTotalMonths()Difference.getTotalYears()
Example Usage
const stime = require('stime');
const timeOne = stime.fromDate(new Date('01-01-2020 00:00:00'));
const timeTwo = stime.fromDate(new Date('06-01-2020 00:00:00'));
const diff = stime.difference(timeOne, timeTwo);
const months = diff.getTotalMonths(); // 5Add getYear and getMonth methods
- Add
getMonthmethod to get the current month number from 1-12 - Add
getYearto get a 4-digit representation of the current year
Add getDay method
- Added
getDaymethod toTimeclass. You can now usegetDayto get the day of the month.
Fix build issue
0.0.5 Add dist files to build
Add fromDate method
- Add fromDate method to create a new time instance from a native Javascript Date object.
Fix issue with browser compatibility
- Convert use of
Math.trunctotoFixedfor better browser compatibility