FEATURE: adds support for seconds in local-dates (#6339)
This commit is contained in:
parent
d40d241e72
commit
3ed9533066
|
@ -13,7 +13,7 @@
|
|||
|
||||
var relativeTime = moment.utc(
|
||||
options.date + " " + options.time,
|
||||
"YYYY-MM-DD HH:mm"
|
||||
"YYYY-MM-DD HH:mm:ss"
|
||||
);
|
||||
|
||||
if (options.recurring && relativeTime < moment().utc()) {
|
||||
|
@ -43,7 +43,13 @@
|
|||
});
|
||||
|
||||
var relativeTime = relativeTime.tz(moment.tz.guess());
|
||||
if (moment(relativeTime).isSame(moment(), "day")) {
|
||||
if (
|
||||
options.format !== "YYYY-MM-DD HH:mm:ss" &&
|
||||
relativeTime.isBetween(
|
||||
moment().subtract(1, "day"),
|
||||
moment().add(2, "day")
|
||||
)
|
||||
) {
|
||||
relativeTime = relativeTime.calendar();
|
||||
} else {
|
||||
relativeTime = relativeTime.format(options.format);
|
||||
|
|
|
@ -2,9 +2,9 @@ import computed from "ember-addons/ember-computed-decorators";
|
|||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
timeFormat: "HH:mm",
|
||||
timeFormat: "HH:mm:ss",
|
||||
dateFormat: "YYYY-MM-DD",
|
||||
dateTimeFormat: "YYYY-MM-DD HH:mm",
|
||||
dateTimeFormat: "YYYY-MM-DD HH:mm:ss",
|
||||
config: null,
|
||||
date: null,
|
||||
toDate: null,
|
||||
|
|
|
@ -6,7 +6,7 @@ function addLocalDate(buffer, matches, state) {
|
|||
let config = {
|
||||
date: null,
|
||||
time: null,
|
||||
format: "YYYY-MM-DD HH:mm",
|
||||
format: "YYYY-MM-DD HH:mm:ss",
|
||||
timezones: ""
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ function addLocalDate(buffer, matches, state) {
|
|||
.filter(t => t)
|
||||
.map(timezone => {
|
||||
const dateTime = moment
|
||||
.utc(`${config.date} ${config.time}`, "YYYY-MM-DD HH:mm")
|
||||
.utc(`${config.date} ${config.time}`, "YYYY-MM-DD HH:mm:ss")
|
||||
.tz(timezone)
|
||||
.format(config.format);
|
||||
|
||||
|
|
Loading…
Reference in New Issue