Returns the day of the month.
Returns the hour of the day, according to local time. The value is from 0 to 23.
Returns the millisecond of the second, according to local time.
Returns the minute of the hour, according to local time.
Returns the month beginning with 1 for January to 12 for December.
Returns the second of the minute, according to local time.
Returns the year, according to local time.
Returns true if this Femto is after other Femto.
Otherwise false.
Note: This method returns false if two Femtos have same value.
If you want true when two Femtos have same value, use isSameOrAfter.
Returns true if this Femto is before other Femto.
Otherwise false.
Note: This method returns false if two Femtos have same value.
If you want true when two Femtos have same value, use isSameOrBefore.
Returns true if this Femto is between from and to'.
Otherwisefalse`.
By default, this method returns false if this Femto and from(or to) are same.
If you want this method to include from or to, set options argument as follows:
femto.isBetween(from, to, {
includesFrom: true,
includesTo: true
});
Returns true if this Femto and other Femto have completely same value.
Otherwise false.
Returns true if this Femto is same or after other Femto.
Otherwise false.
Returns true if this Femto is same or before other Femto.
Otherwise false.
Returns Date.
Returns a number of milliseconds since January 1, 1970, 00:00:00 UTC.
Returns a string which is template string replaced with values.
This method takes a template string which includes special letters called "token", and replace them with their corresponding values.
For example, token 'YYYY' will be replaced with the year value like as '2018'.
Femto.now().format('YYYY'); // 2018
Femto.now().format('YYYY/MM/DD'); // 2018/06/22
Femto.now().format('YYYY/MM/DD HH:mm:ss'); // 2018/06/22 14:32:57
In template, you can use following tokens:
Returns ISO string.
Returns a Femto object created by date.
Returns a Femto object created from epoch time.
Milliseconds since January 1, 1970, 00:00:00 UTC.
Returns a Femto object which represents current time.
Generated using TypeDoc
An object representing date.
Femtois a core class of femtofiber, which represents date.You can create a
Femtoobject in several ways.const femto1 = new Femto(2018, 6, 22); // from number const femto2 = new Femto(2018, 6, 22, 21, 54, 31, 500); // from numbers with time const femto3 = Femto.fromDate(new Date()); // from Date const femto4 = Femto.now(); // from current date const femto5 = Femto.fromEpochTime(1529590253022); // from epoch timeA
Femtoobject is immutable, so once created, its value does not change.To get values, use properties.
const femto = Femto.now(); console.log(femto.year); console.log(femto.month); // January is 1, and December is 12 console.log(femto.day); console.log(femto.hour); console.log(femto.minute); console.log(femto.second); console.log(femto.millisecond);A
Femtoobject also can output formatted string.const femto = Femto.now(); console.log(femto.toFormatString('YYYY/MM/DD')); // "2018/06/22" console.log(femto.toFormatString('HH:mm:ss:SSS')); // "18:23:27:758"A
Femtoobject has manipulating methods. You can manipulate date with Duration objects.const tomorrow = Femto.now().add(new Duration({days: 1})); const yesterday = Femto.now().sub(new Duration({days: 1}));You can also compare two Femtos.
const current = 1529665309363; const femto1 = Femto.fromEpochTime(current); const femto2 = Femto.fromEpochTime(current); // These methods returns boolean. femto1.isSame(femto2); femto1.isBefore(femto2); femto1.isAfter(femto2); femto1.isSameOrBefore(femto2); femto1.isSameOrAfter(femto2); Femto.now().isBetween(femto1, femto2); Femto.now().isBetween(femto1, femto2, { includesFrom: true, includesTo: true });