Skip to content

Releases: TerenceJefferies/STime

Bug fixes

01 Mar 12:35

Choose a tag to compare

1.1.1

Tag version

Fix security vulnerabilities

01 Mar 12:26
e5e698f

Choose a tag to compare

This version includes a number of security vulnerability fixes.

Add parse option

27 Jun 17:52

Choose a tag to compare

  • Add parse option to main API, you can now parse strings into time instances.

Add create from now builder

21 Jun 09:27

Choose a tag to compare

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
  • yesterday method added
  • tomorrow method added

Add difference system

20 Jun 14:47

Choose a tag to compare

  • 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(); // 5

Add getYear and getMonth methods

19 Jun 21:47

Choose a tag to compare

  • Add getMonth method to get the current month number from 1-12
  • Add getYear to get a 4-digit representation of the current year

Add getDay method

19 Jun 21:18

Choose a tag to compare

  • Added getDay method to Time class. You can now use getDay to get the day of the month.

Fix build issue

19 Jun 21:24

Choose a tag to compare

0.0.5

Add dist files to build

Add fromDate method

19 Jun 21:09

Choose a tag to compare

  • Add fromDate method to create a new time instance from a native Javascript Date object.

Fix issue with browser compatibility

19 Jun 21:02

Choose a tag to compare

  • Convert use of Math.trunc to toFixed for better browser compatibility