From e1846905b0d0a3e54e798683fd468832eff71084 Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Wed, 8 May 2019 17:47:09 +0800 Subject: Add momentjs wrapper to kvision-modules --- .../kotlin/pl/treksoft/kvision/KVManagerMoment.kt | 38 ++++++++ .../src/main/kotlin/pl/treksoft/kvision/Options.kt | 100 +++++++++++++++++++++ .../main/kotlin/pl/treksoft/kvision/js/Moment.kt | 84 +++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt create mode 100644 kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt create mode 100644 kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt (limited to 'kvision-modules/kvision-moment/src') diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt new file mode 100644 index 00000000..b1a35552 --- /dev/null +++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package pl.treksoft.kvision + +import pl.treksoft.kvision.require + +internal val kVManagerMomentInit = KVManagerMoment.init() + +/** + * Internal singleton object which initializes and configures KVision Moment module. + */ +@Suppress("EmptyCatchBlock", "TooGenericExceptionCaught") +internal object KVManagerMoment { + fun init() {} + + private val moment = try { + require("moment/min/moment-with-locales.js") + } catch (e: Throwable) {} +} diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt new file mode 100644 index 00000000..fef685e0 --- /dev/null +++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.fleethome.util.kvision + +import pl.treksoft.kvision.utils.obj +import kotlin.js.Promise + +/** + * Format Display Option. + */ +enum class FormatDisplayOption(internal val displayOption: String) { + MonthM("M"), + MonthMo("Mo"), + MonthMM("MM"), + MonthMMM("MMM"), + MonthMMMM("MMMM"), + QuarterQ("Q"), + QuarterQo("Qo"), + DayOfMonthD("D"), + DayOfMonthDo("Do"), + DayOfMonthDD("DD"), + DayOfYearDDD("DDD"), + DayOfYearDDDo("DDDo"), + DayOfYearDDDD("DDDD"), + DayOfWeekdo("do"), + DayOfWeekdd("dd"), + DayOfWeekddd("ddd"), + DayOfWeekdddd("dddd"), + DayOfWeekLocale("e"), + DayOfWeekISO("E"), + WeekOfYearw("w"), + WeekOfYearwo("wo"), + WeekOfYearww("ww"), + WeekOfYearISOW("W"), + WeekOfYearISOWo("Wo"), + WeekOfYearISOWW("WW"), + YearYY("YY"), + YearYYYY("YYYY"), + YearY("Y"), + WeekYeargg("gg"), + WeekYeargggg("gggg"), + WeekYearISOGG("GG"), + WeekYearISOGGGG("GGGG"), + AmPmUpperCase("A"), + AmPmLowerCase("a"), + HourH("H"), + HourHH("HH"), + Hourh("h"), + Hourhh("hh"), + Hourk("k"), + Hourkk("kk"), + Minutem("m"), + Minutemm("mm"), + Seconds("s"), + Secondss("ss"), + FractionalSecondS("S"), + FractionalSecondSS("SS"), + FractionalSecondSSS("SSS"), + FractionalSecondSSSS("SSSS"), + TimeZoneZ("Z"), + TimeZoneZZ("ZZ"), + Unix("X"), + UnixMM("x") +} + +/** + * Localized Format Display Option. + */ +enum class LocalizedFormatDisplayOption(internal val displayOption: String) { + LT("LT"), + LTS("LTS"), + L("L"), + l("l"), + LL("LL"), + ll("ll"), + LLL("LLL"), + lll("lll"), + LLLL("LLLL"), + llll("llll") +} \ No newline at end of file diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt new file mode 100644 index 00000000..95827ce6 --- /dev/null +++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt @@ -0,0 +1,84 @@ +@file:Suppress( + "INTERFACE_WITH_SUPERCLASS", + "OVERRIDING_FINAL_MEMBER", + "RETURN_TYPE_MISMATCH_ON_OVERRIDE", + "CONFLICTING_OVERLOADS", + "EXTERNAL_DELEGATION", + "NESTED_CLASS_IN_EXTERNAL_INTERFACE", + "unused", "PropertyName", "TooManyFunctions", "VariableNaming", "MaxLineLength" +) + +package pl.treksoft.kvision.moment.js + +import com.fleethome.util.kvision.FormatDisplayOption +import com.fleethome.util.kvision.LocalizedFormatDisplayOption +import kotlin.js.Date + +@Suppress("ClassName") +@JsNonModule +@JsModule("moment") +open external class Moment { + constructor(dateArray: Array) + constructor(dateString: String, patter: String) + constructor(dateString: String) + constructor(date: Date) + constructor() + + open fun add(duration: dynamic, key: String): dynamic = definedExternally + open fun subtract(duration: dynamic, key: String): dynamic = definedExternally + open fun startOf(key: String): dynamic = definedExternally + open fun endOf(key: String): dynamic = definedExternally + open fun local(): dynamic = definedExternally + open fun utc(): dynamic = definedExternally + open fun utcOffset(): dynamic = definedExternally + open fun utcOffset(amount: dynamic): dynamic = definedExternally + open fun utcOffset(amount: dynamic, keepExistingTimeOfDay: Boolean): dynamic = definedExternally + open fun format(pattern: String): dynamic = definedExternally + open fun format(displayOption: FormatDisplayOption): dynamic = definedExternally + open fun format(localizedDisplayOption: LocalizedFormatDisplayOption): dynamic = definedExternally + open fun format(): dynamic = definedExternally + open fun fromNow(): dynamic = definedExternally + open fun fromNow(withoutSuffix: Boolean): dynamic = definedExternally + open fun from(moment: dynamic): dynamic = definedExternally + open fun from(withoutSuffix: Boolean): dynamic = definedExternally + open fun toNow(): dynamic = definedExternally + open fun toNow(withoutPrefix: Boolean): dynamic = definedExternally + open fun to(moment: dynamic): dynamic = definedExternally + open fun to(withoutPrefix: Boolean): dynamic = definedExternally + open fun calendar(): dynamic = definedExternally + open fun calendar(referenceTime: dynamic): dynamic = definedExternally + open fun calendar(referenceTime: dynamic, formats: dynamic): dynamic = definedExternally + open fun diff(moment: dynamic): dynamic = definedExternally + open fun diff(moment: dynamic, key: dynamic): dynamic = definedExternally + open fun diff(moment: dynamic, key: dynamic, floatingPoint: Boolean): dynamic = definedExternally + open fun valueOf(): dynamic = definedExternally + open fun unix(): dynamic = definedExternally + open fun daysInMonth(): dynamic = definedExternally + open fun toDate(): dynamic = definedExternally + open fun toArray(): dynamic = definedExternally + open fun toJSON(): dynamic = definedExternally + open fun toISOString(): dynamic = definedExternally + open fun toISOString(keepOffset: Boolean): dynamic = definedExternally + open fun toObject(): dynamic = definedExternally + open fun inspect(): dynamic = definedExternally + open fun isBefore(moment: dynamic): Boolean = definedExternally + open fun isBefore(moment: dynamic, key: String): Boolean = definedExternally + open fun isSame(moment: dynamic): Boolean = definedExternally + open fun isSame(moment: dynamic, key: String): Boolean = definedExternally + open fun isAfter(moment: dynamic): Boolean = definedExternally + open fun isAfter(moment: dynamic, key: String): Boolean = definedExternally + open fun isSameOrBefore(moment: dynamic): Boolean = definedExternally + open fun isSameOrBefore(moment: dynamic, key: String): Boolean = definedExternally + open fun isSameOrAfter(moment: dynamic): Boolean = definedExternally + open fun isSameOrAfter(moment: dynamic, key: String): Boolean = definedExternally + open fun isBetween(firstMoment: dynamic, secondMoment: dynamic): Boolean = definedExternally + open fun isBetween(firstMoment: dynamic, secondMoment: dynamic, key: String, inclusivity: String): Boolean = definedExternally + open fun isBetween(firstMoment: dynamic, secondMoment: dynamic, key: String): Boolean = definedExternally + open fun isDST(): Boolean = definedExternally + open fun isDSTShifted(): Boolean = definedExternally + open fun isLeapYear(): Boolean = definedExternally + open fun locale(locale: String): dynamic = definedExternally + open fun locale(resetLocale: Boolean): dynamic = definedExternally + open fun lang(locale: String): dynamic = definedExternally + open fun lang(resetLocale: Boolean): dynamic = definedExternally +} -- cgit From a4ff9633a6c7dfa739fdf518b3847d3fcf2d4fcd Mon Sep 17 00:00:00 2001 From: Robbie Cronin Date: Wed, 8 May 2019 21:49:33 +0800 Subject: update to match standards of other kvision module --- .../kotlin/pl/treksoft/kvision/KVManagerMoment.kt | 2 - .../src/main/kotlin/pl/treksoft/kvision/Options.kt | 100 --------------------- .../main/kotlin/pl/treksoft/kvision/js/Moment.kt | 84 ----------------- .../kotlin/pl/treksoft/kvision/moment/Moment.kt | 91 +++++++++++++++++++ 4 files changed, 91 insertions(+), 186 deletions(-) delete mode 100644 kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt delete mode 100644 kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt create mode 100644 kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt (limited to 'kvision-modules/kvision-moment/src') diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt index b1a35552..0000db83 100644 --- a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt +++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/KVManagerMoment.kt @@ -21,8 +21,6 @@ */ package pl.treksoft.kvision -import pl.treksoft.kvision.require - internal val kVManagerMomentInit = KVManagerMoment.init() /** diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt deleted file mode 100644 index fef685e0..00000000 --- a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/Options.kt +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017-present Robert Jaros - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.fleethome.util.kvision - -import pl.treksoft.kvision.utils.obj -import kotlin.js.Promise - -/** - * Format Display Option. - */ -enum class FormatDisplayOption(internal val displayOption: String) { - MonthM("M"), - MonthMo("Mo"), - MonthMM("MM"), - MonthMMM("MMM"), - MonthMMMM("MMMM"), - QuarterQ("Q"), - QuarterQo("Qo"), - DayOfMonthD("D"), - DayOfMonthDo("Do"), - DayOfMonthDD("DD"), - DayOfYearDDD("DDD"), - DayOfYearDDDo("DDDo"), - DayOfYearDDDD("DDDD"), - DayOfWeekdo("do"), - DayOfWeekdd("dd"), - DayOfWeekddd("ddd"), - DayOfWeekdddd("dddd"), - DayOfWeekLocale("e"), - DayOfWeekISO("E"), - WeekOfYearw("w"), - WeekOfYearwo("wo"), - WeekOfYearww("ww"), - WeekOfYearISOW("W"), - WeekOfYearISOWo("Wo"), - WeekOfYearISOWW("WW"), - YearYY("YY"), - YearYYYY("YYYY"), - YearY("Y"), - WeekYeargg("gg"), - WeekYeargggg("gggg"), - WeekYearISOGG("GG"), - WeekYearISOGGGG("GGGG"), - AmPmUpperCase("A"), - AmPmLowerCase("a"), - HourH("H"), - HourHH("HH"), - Hourh("h"), - Hourhh("hh"), - Hourk("k"), - Hourkk("kk"), - Minutem("m"), - Minutemm("mm"), - Seconds("s"), - Secondss("ss"), - FractionalSecondS("S"), - FractionalSecondSS("SS"), - FractionalSecondSSS("SSS"), - FractionalSecondSSSS("SSSS"), - TimeZoneZ("Z"), - TimeZoneZZ("ZZ"), - Unix("X"), - UnixMM("x") -} - -/** - * Localized Format Display Option. - */ -enum class LocalizedFormatDisplayOption(internal val displayOption: String) { - LT("LT"), - LTS("LTS"), - L("L"), - l("l"), - LL("LL"), - ll("ll"), - LLL("LLL"), - lll("lll"), - LLLL("LLLL"), - llll("llll") -} \ No newline at end of file diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt deleted file mode 100644 index 95827ce6..00000000 --- a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/js/Moment.kt +++ /dev/null @@ -1,84 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "EXTERNAL_DELEGATION", - "NESTED_CLASS_IN_EXTERNAL_INTERFACE", - "unused", "PropertyName", "TooManyFunctions", "VariableNaming", "MaxLineLength" -) - -package pl.treksoft.kvision.moment.js - -import com.fleethome.util.kvision.FormatDisplayOption -import com.fleethome.util.kvision.LocalizedFormatDisplayOption -import kotlin.js.Date - -@Suppress("ClassName") -@JsNonModule -@JsModule("moment") -open external class Moment { - constructor(dateArray: Array) - constructor(dateString: String, patter: String) - constructor(dateString: String) - constructor(date: Date) - constructor() - - open fun add(duration: dynamic, key: String): dynamic = definedExternally - open fun subtract(duration: dynamic, key: String): dynamic = definedExternally - open fun startOf(key: String): dynamic = definedExternally - open fun endOf(key: String): dynamic = definedExternally - open fun local(): dynamic = definedExternally - open fun utc(): dynamic = definedExternally - open fun utcOffset(): dynamic = definedExternally - open fun utcOffset(amount: dynamic): dynamic = definedExternally - open fun utcOffset(amount: dynamic, keepExistingTimeOfDay: Boolean): dynamic = definedExternally - open fun format(pattern: String): dynamic = definedExternally - open fun format(displayOption: FormatDisplayOption): dynamic = definedExternally - open fun format(localizedDisplayOption: LocalizedFormatDisplayOption): dynamic = definedExternally - open fun format(): dynamic = definedExternally - open fun fromNow(): dynamic = definedExternally - open fun fromNow(withoutSuffix: Boolean): dynamic = definedExternally - open fun from(moment: dynamic): dynamic = definedExternally - open fun from(withoutSuffix: Boolean): dynamic = definedExternally - open fun toNow(): dynamic = definedExternally - open fun toNow(withoutPrefix: Boolean): dynamic = definedExternally - open fun to(moment: dynamic): dynamic = definedExternally - open fun to(withoutPrefix: Boolean): dynamic = definedExternally - open fun calendar(): dynamic = definedExternally - open fun calendar(referenceTime: dynamic): dynamic = definedExternally - open fun calendar(referenceTime: dynamic, formats: dynamic): dynamic = definedExternally - open fun diff(moment: dynamic): dynamic = definedExternally - open fun diff(moment: dynamic, key: dynamic): dynamic = definedExternally - open fun diff(moment: dynamic, key: dynamic, floatingPoint: Boolean): dynamic = definedExternally - open fun valueOf(): dynamic = definedExternally - open fun unix(): dynamic = definedExternally - open fun daysInMonth(): dynamic = definedExternally - open fun toDate(): dynamic = definedExternally - open fun toArray(): dynamic = definedExternally - open fun toJSON(): dynamic = definedExternally - open fun toISOString(): dynamic = definedExternally - open fun toISOString(keepOffset: Boolean): dynamic = definedExternally - open fun toObject(): dynamic = definedExternally - open fun inspect(): dynamic = definedExternally - open fun isBefore(moment: dynamic): Boolean = definedExternally - open fun isBefore(moment: dynamic, key: String): Boolean = definedExternally - open fun isSame(moment: dynamic): Boolean = definedExternally - open fun isSame(moment: dynamic, key: String): Boolean = definedExternally - open fun isAfter(moment: dynamic): Boolean = definedExternally - open fun isAfter(moment: dynamic, key: String): Boolean = definedExternally - open fun isSameOrBefore(moment: dynamic): Boolean = definedExternally - open fun isSameOrBefore(moment: dynamic, key: String): Boolean = definedExternally - open fun isSameOrAfter(moment: dynamic): Boolean = definedExternally - open fun isSameOrAfter(moment: dynamic, key: String): Boolean = definedExternally - open fun isBetween(firstMoment: dynamic, secondMoment: dynamic): Boolean = definedExternally - open fun isBetween(firstMoment: dynamic, secondMoment: dynamic, key: String, inclusivity: String): Boolean = definedExternally - open fun isBetween(firstMoment: dynamic, secondMoment: dynamic, key: String): Boolean = definedExternally - open fun isDST(): Boolean = definedExternally - open fun isDSTShifted(): Boolean = definedExternally - open fun isLeapYear(): Boolean = definedExternally - open fun locale(locale: String): dynamic = definedExternally - open fun locale(resetLocale: Boolean): dynamic = definedExternally - open fun lang(locale: String): dynamic = definedExternally - open fun lang(resetLocale: Boolean): dynamic = definedExternally -} diff --git a/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt new file mode 100644 index 00000000..9eb9d9a7 --- /dev/null +++ b/kvision-modules/kvision-moment/src/main/kotlin/pl/treksoft/kvision/moment/Moment.kt @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2017-present Robert Jaros + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package pl.treksoft.kvision.moment + +import kotlin.js.Date + +@Suppress("unused") +@JsNonModule +@JsModule("moment") +open external class Moment { + constructor(dateArray: Array) + constructor(dateString: String, patter: String) + constructor(dateString: String) + constructor(date: Date) + constructor() + + open fun add(duration: dynamic, key: String): dynamic = definedExternally + open fun subtract(duration: dynamic, key: String): dynamic = definedExternally + open fun startOf(key: String): dynamic = definedExternally + open fun endOf(key: String): dynamic = definedExternally + open fun local(): dynamic = definedExternally + open fun utc(): dynamic = definedExternally + open fun utcOffset(): dynamic = definedExternally + open fun utcOffset(amount: dynamic): dynamic = definedExternally + open fun utcOffset(amount: dynamic, keepExistingTimeOfDay: Boolean): dynamic = definedExternally + open fun format(pattern: String): dynamic = definedExternally + open fun format(): dynamic = definedExternally + open fun fromNow(): dynamic = definedExternally + open fun fromNow(withoutSuffix: Boolean): dynamic = definedExternally + open fun from(moment: dynamic): dynamic = definedExternally + open fun from(withoutSuffix: Boolean): dynamic = definedExternally + open fun toNow(): dynamic = definedExternally + open fun toNow(withoutPrefix: Boolean): dynamic = definedExternally + open fun to(moment: dynamic): dynamic = definedExternally + open fun to(withoutPrefix: Boolean): dynamic = definedExternally + open fun calendar(): dynamic = definedExternally + open fun calendar(referenceTime: dynamic): dynamic = definedExternally + open fun calendar(referenceTime: dynamic, formats: dynamic): dynamic = definedExternally + open fun diff(moment: dynamic): dynamic = definedExternally + open fun diff(moment: dynamic, key: dynamic): dynamic = definedExternally + open fun diff(moment: dynamic, key: dynamic, floatingPoint: Boolean): dynamic = definedExternally + open fun valueOf(): dynamic = definedExternally + open fun unix(): dynamic = definedExternally + open fun daysInMonth(): dynamic = definedExternally + open fun toDate(): dynamic = definedExternally + open fun toArray(): dynamic = definedExternally + open fun toJSON(): dynamic = definedExternally + open fun toISOString(): dynamic = definedExternally + open fun toISOString(keepOffset: Boolean): dynamic = definedExternally + open fun toObject(): dynamic = definedExternally + open fun inspect(): dynamic = definedExternally + open fun isBefore(moment: dynamic): Boolean = definedExternally + open fun isBefore(moment: dynamic, key: String): Boolean = definedExternally + open fun isSame(moment: dynamic): Boolean = definedExternally + open fun isSame(moment: dynamic, key: String): Boolean = definedExternally + open fun isAfter(moment: dynamic): Boolean = definedExternally + open fun isAfter(moment: dynamic, key: String): Boolean = definedExternally + open fun isSameOrBefore(moment: dynamic): Boolean = definedExternally + open fun isSameOrBefore(moment: dynamic, key: String): Boolean = definedExternally + open fun isSameOrAfter(moment: dynamic): Boolean = definedExternally + open fun isSameOrAfter(moment: dynamic, key: String): Boolean = definedExternally + open fun isBetween(firstMoment: dynamic, secondMoment: dynamic): Boolean = definedExternally + open fun isBetween(firstMoment: dynamic, secondMoment: dynamic, key: String, inclusivity: String): Boolean = definedExternally + open fun isBetween(firstMoment: dynamic, secondMoment: dynamic, key: String): Boolean = definedExternally + open fun isDST(): Boolean = definedExternally + open fun isDSTShifted(): Boolean = definedExternally + open fun isLeapYear(): Boolean = definedExternally + open fun locale(locale: String): dynamic = definedExternally + open fun locale(resetLocale: Boolean): dynamic = definedExternally + open fun lang(locale: String): dynamic = definedExternally + open fun lang(resetLocale: Boolean): dynamic = definedExternally +} -- cgit