@date-io/moment
Advanced tools
Comparing version
@@ -13,2 +13,4 @@ import defaultMoment from 'moment'; | ||
monthAndYear: "MMMM YYYY", | ||
weekday: "dddd", | ||
weekdayShort: "ddd", | ||
minutes: "mm", | ||
@@ -22,2 +24,3 @@ hours12h: "hh", | ||
fullDate: "ll", | ||
fullDateWithWeekday: "dddd, LL", | ||
fullDateTime: "lll", | ||
@@ -29,3 +32,3 @@ fullDateTime12h: "ll hh:mm A", | ||
keyboardDateTime12h: "L hh:mm A", | ||
keyboardDateTime24h: "L HH:mm" | ||
keyboardDateTime24h: "L HH:mm", | ||
}; | ||
@@ -40,5 +43,3 @@ var MomentUtils = /** @class */ (function () { | ||
MomentUtils.prototype.is12HourCycleInCurrentLocale = function () { | ||
return /A|a/.test(this.moment() | ||
.localeData() | ||
.longDateFormat("LT")); | ||
return /A|a/.test(this.moment().localeData().longDateFormat("LT")); | ||
}; | ||
@@ -69,2 +70,5 @@ MomentUtils.prototype.getFormatHelperText = function (format) { | ||
} | ||
if (this.locale) { | ||
return this.moment(value, format, this.locale, true); | ||
} | ||
return this.moment(value, format, true); | ||
@@ -120,4 +124,5 @@ }; | ||
MomentUtils.prototype.formatByString = function (date, formatString) { | ||
date.locale(this.locale); | ||
return date.format(formatString); | ||
var clonedDate = date.clone(); | ||
clonedDate.locale(this.locale); | ||
return clonedDate.format(formatString); | ||
}; | ||
@@ -210,6 +215,3 @@ MomentUtils.prototype.formatNumber = function (numberToFormat) { | ||
MomentUtils.prototype.mergeDateAndTime = function (date, time) { | ||
return date | ||
.hour(time.hour()) | ||
.minute(time.minute()) | ||
.second(time.second()); | ||
return date.hour(time.hour()).minute(time.minute()).second(time.second()); | ||
}; | ||
@@ -226,10 +228,4 @@ MomentUtils.prototype.getWeekdays = function () { | ||
MomentUtils.prototype.getWeekArray = function (date) { | ||
var start = date | ||
.clone() | ||
.startOf("month") | ||
.startOf("week"); | ||
var end = date | ||
.clone() | ||
.endOf("month") | ||
.endOf("week"); | ||
var start = date.clone().startOf("month").startOf("week"); | ||
var end = date.clone().endOf("month").endOf("week"); | ||
var count = 0; | ||
@@ -236,0 +232,0 @@ var current = start; |
@@ -17,2 +17,4 @@ 'use strict'; | ||
monthAndYear: "MMMM YYYY", | ||
weekday: "dddd", | ||
weekdayShort: "ddd", | ||
minutes: "mm", | ||
@@ -26,2 +28,3 @@ hours12h: "hh", | ||
fullDate: "ll", | ||
fullDateWithWeekday: "dddd, LL", | ||
fullDateTime: "lll", | ||
@@ -33,3 +36,3 @@ fullDateTime12h: "ll hh:mm A", | ||
keyboardDateTime12h: "L hh:mm A", | ||
keyboardDateTime24h: "L HH:mm" | ||
keyboardDateTime24h: "L HH:mm", | ||
}; | ||
@@ -44,5 +47,3 @@ var MomentUtils = /** @class */ (function () { | ||
MomentUtils.prototype.is12HourCycleInCurrentLocale = function () { | ||
return /A|a/.test(this.moment() | ||
.localeData() | ||
.longDateFormat("LT")); | ||
return /A|a/.test(this.moment().localeData().longDateFormat("LT")); | ||
}; | ||
@@ -73,2 +74,5 @@ MomentUtils.prototype.getFormatHelperText = function (format) { | ||
} | ||
if (this.locale) { | ||
return this.moment(value, format, this.locale, true); | ||
} | ||
return this.moment(value, format, true); | ||
@@ -124,4 +128,5 @@ }; | ||
MomentUtils.prototype.formatByString = function (date, formatString) { | ||
date.locale(this.locale); | ||
return date.format(formatString); | ||
var clonedDate = date.clone(); | ||
clonedDate.locale(this.locale); | ||
return clonedDate.format(formatString); | ||
}; | ||
@@ -214,6 +219,3 @@ MomentUtils.prototype.formatNumber = function (numberToFormat) { | ||
MomentUtils.prototype.mergeDateAndTime = function (date, time) { | ||
return date | ||
.hour(time.hour()) | ||
.minute(time.minute()) | ||
.second(time.second()); | ||
return date.hour(time.hour()).minute(time.minute()).second(time.second()); | ||
}; | ||
@@ -230,10 +232,4 @@ MomentUtils.prototype.getWeekdays = function () { | ||
MomentUtils.prototype.getWeekArray = function (date) { | ||
var start = date | ||
.clone() | ||
.startOf("month") | ||
.startOf("week"); | ||
var end = date | ||
.clone() | ||
.endOf("month") | ||
.endOf("week"); | ||
var start = date.clone().startOf("month").startOf("week"); | ||
var end = date.clone().endOf("month").endOf("week"); | ||
var count = 0; | ||
@@ -240,0 +236,0 @@ var current = start; |
{ | ||
"name": "@date-io/moment", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "Abstraction over common javascript date management libraries", | ||
@@ -12,3 +12,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@date-io/core": "^2.6.0" | ||
"@date-io/core": "^2.7.0" | ||
}, | ||
@@ -44,3 +44,3 @@ "devDependencies": { | ||
"license": "MIT", | ||
"gitHead": "d6db25c9863530a6d5934a2f8b97b1f0162d967d" | ||
"gitHead": "659d6c1858a313cff392aa27b03d1c5bcc1a3e29" | ||
} |
@@ -1,4 +0,4 @@ | ||
import typescript from 'typescript' | ||
import { createRollupConfig } from '@date-io/core/dev-utils' | ||
import typescript from "typescript"; | ||
import { createRollupConfig } from "@date-io/core/dev-utils"; | ||
export default createRollupConfig(typescript) | ||
export default createRollupConfig(typescript); |
@@ -21,2 +21,4 @@ import defaultMoment, { LongDateFormatKey } from "moment"; | ||
monthAndYear: "MMMM YYYY", | ||
weekday: "dddd", | ||
weekdayShort: "ddd", | ||
minutes: "mm", | ||
@@ -30,2 +32,3 @@ hours12h: "hh", | ||
fullDate: "ll", | ||
fullDateWithWeekday: "dddd, LL", | ||
fullDateTime: "lll", | ||
@@ -37,3 +40,3 @@ fullDateTime12h: "ll hh:mm A", | ||
keyboardDateTime12h: "L hh:mm A", | ||
keyboardDateTime24h: "L HH:mm" | ||
keyboardDateTime24h: "L HH:mm", | ||
}; | ||
@@ -54,7 +57,3 @@ | ||
public is12HourCycleInCurrentLocale() { | ||
return /A|a/.test( | ||
this.moment() | ||
.localeData() | ||
.longDateFormat("LT") | ||
); | ||
return /A|a/.test(this.moment().localeData().longDateFormat("LT")); | ||
} | ||
@@ -67,3 +66,3 @@ | ||
.match(localFormattingTokens) | ||
.map(token => { | ||
.map((token) => { | ||
const firstCharacter = token[0]; | ||
@@ -90,2 +89,6 @@ if (firstCharacter === "L" || firstCharacter === ";") { | ||
if (this.locale) { | ||
return this.moment(value, format, this.locale, true); | ||
} | ||
return this.moment(value, format, true); | ||
@@ -158,4 +161,5 @@ } | ||
public formatByString(date: Moment, formatString: string) { | ||
date.locale(this.locale); | ||
return date.format(formatString); | ||
const clonedDate = date.clone(); | ||
clonedDate.locale(this.locale); | ||
return clonedDate.format(formatString); | ||
} | ||
@@ -276,6 +280,3 @@ | ||
public mergeDateAndTime(date: Moment, time: Moment) { | ||
return date | ||
.hour(time.hour()) | ||
.minute(time.minute()) | ||
.second(time.second()); | ||
return date.hour(time.hour()).minute(time.minute()).second(time.second()); | ||
} | ||
@@ -296,10 +297,4 @@ | ||
public getWeekArray(date: Moment) { | ||
const start = date | ||
.clone() | ||
.startOf("month") | ||
.startOf("week"); | ||
const end = date | ||
.clone() | ||
.endOf("month") | ||
.endOf("week"); | ||
const start = date.clone().startOf("month").startOf("week"); | ||
const end = date.clone().endOf("month").endOf("week"); | ||
@@ -306,0 +301,0 @@ let count = 0; |
32297
1%843
-1.63%Updated