Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
388649659c | |||
e8ff289a9a | |||
a5deb25bfb | |||
ce2d1b278b |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarttime",
|
"name": "@pushrocks/smarttime",
|
||||||
"version": "3.0.8",
|
"version": "3.0.10",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarttime",
|
"name": "@pushrocks/smarttime",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "3.0.8",
|
"version": "3.0.10",
|
||||||
"description": "handle time in smart ways",
|
"description": "handle time in smart ways",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -3,6 +3,10 @@ import * as plugins from './smarttime.plugins';
|
|||||||
export type TAvailableZone = 'Europe/Berlin';
|
export type TAvailableZone = 'Europe/Berlin';
|
||||||
|
|
||||||
export class ExtendedDate extends Date {
|
export class ExtendedDate extends Date {
|
||||||
|
public static fromMillis(milliSeconds: number) {
|
||||||
|
return new ExtendedDate(milliSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
public static fromEuropeanDate(europeanDate: string) {
|
public static fromEuropeanDate(europeanDate: string) {
|
||||||
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDate);
|
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDate);
|
||||||
const luxonDate = plugins.luxon.DateTime.utc(
|
const luxonDate = plugins.luxon.DateTime.utc(
|
||||||
@ -17,8 +21,8 @@ export class ExtendedDate extends Date {
|
|||||||
/** */
|
/** */
|
||||||
public static fromEuropeanDateAndTime(
|
public static fromEuropeanDateAndTime(
|
||||||
europeanDateArg: string,
|
europeanDateArg: string,
|
||||||
timeArg: string,
|
timeArg: string = '12:00:00',
|
||||||
zoneArg: TAvailableZone
|
zoneArg: TAvailableZone = 'Europe/Berlin'
|
||||||
) {
|
) {
|
||||||
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDateArg);
|
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDateArg);
|
||||||
const sliceDate = (dateString: string) => {
|
const sliceDate = (dateString: string) => {
|
||||||
|
Reference in New Issue
Block a user