//! locale : Italian [it]
//! author : Lorenzo : https://github.com/aliem
//! author: Mattia Larentis: https://github.com/nostalgiaz
+//! author: Marco : https://github.com/Manfre98
import moment from '../moment';
LLLL: 'dddd D MMMM YYYY HH:mm',
},
calendar: {
- sameDay: '[Oggi alle] LT',
- nextDay: '[Domani alle] LT',
- nextWeek: 'dddd [alle] LT',
- lastDay: '[Ieri alle] LT',
+ sameDay: function () {
+ return (
+ '[Oggi a' +
+ (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ );
+ },
+ nextDay: function () {
+ return (
+ '[Domani a' +
+ (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ );
+ },
+ nextWeek: function () {
+ return (
+ 'dddd [a' +
+ (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ );
+ },
+ lastDay: function () {
+ return (
+ '[Ieri a' +
+ (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ );
+ },
lastWeek: function () {
switch (this.day()) {
case 0:
- return '[la scorsa] dddd [alle] LT';
+ return (
+ '[La scorsa] dddd [a' +
+ (this.hours() > 1
+ ? 'lle '
+ : this.hours() === 0
+ ? ' '
+ : "ll'") +
+ ']LT'
+ );
default:
- return '[lo scorso] dddd [alle] LT';
+ return (
+ '[Lo scorso] dddd [a' +
+ (this.hours() > 1
+ ? 'lle '
+ : this.hours() === 0
+ ? ' '
+ : "ll'") +
+ ']LT'
+ );
}
},
sameElse: 'L',
'Domani alle 12:00',
'tomorrow at the same time'
);
+ assert.equal(
+ moment(a).add({ d: 1, h: -1 }).calendar(),
+ 'Domani alle 11:00',
+ 'tomorrow minus 1 hour'
+ );
assert.equal(
moment(a).subtract({ h: 1 }).calendar(),
'Oggi alle 11:00',
m = moment().add({ d: i });
assert.equal(
m.calendar(),
- m.format('dddd [alle] LT'),
+ m.format(
+ 'dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ ),
'Today + ' + i + ' days current time'
);
m.hours(0).minutes(0).seconds(0).milliseconds(0);
assert.equal(
m.calendar(),
- m.format('dddd [alle] LT'),
+ m.format(
+ 'dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ ),
'Today + ' + i + ' days beginning of day'
);
m.hours(23).minutes(59).seconds(59).milliseconds(999);
assert.equal(
m.calendar(),
- m.format('dddd [alle] LT'),
+ m.format(
+ 'dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ ),
'Today + ' + i + ' days end of day'
);
}
weekday = parseInt(m.format('d'), 10);
datestring =
weekday === 0
- ? '[la scorsa] dddd [alle] LT'
- : '[lo scorso] dddd [alle] LT';
+ ? '[La scorsa] dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ : '[Lo scorso] dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT';
assert.equal(
m.calendar(),
m.format(datestring),
'Today - ' + i + ' days current time'
);
m.hours(0).minutes(0).seconds(0).milliseconds(0);
+ datestring =
+ weekday === 0
+ ? '[La scorsa] dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ : '[Lo scorso] dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT';
assert.equal(
m.calendar(),
m.format(datestring),
'Today - ' + i + ' days beginning of day'
);
m.hours(23).minutes(59).seconds(59).milliseconds(999);
+ datestring =
+ weekday === 0
+ ? '[La scorsa] dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT'
+ : '[Lo scorso] dddd [a' +
+ (m.hours() > 1 ? 'lle ' : m.hours() === 0 ? ' ' : "ll'") +
+ ']LT';
assert.equal(
m.calendar(),
m.format(datestring),