我有两个luxon对象
let startDate = DateTime.fromISO(startDate)
let someDate = DateTime.fromISO(someDate)
如果someDate是<= startDate,只有日期而不是时间,我该如何比较?
答案 0 :(得分:8)
要仅比较日期,请使用<?xml version="1.0" encoding="UTF-8"?>
<UserStoreManager class="com.wso2.custom.usermgt.CustomUserStoreManager">
<Property name="url">jdbc:mysql://localhost:3306/wso2</Property>
<Property name="userName">root</Property>
<Property encrypted="true" name="password">subhash123</Property>
<Property name="driverName">com.mysql.jdbc.Driver</Property>
<Property name="ReadGroups">true</Property> .......................................
startOf
答案 1 :(得分:3)
使用x = [1, 2]
x.append([3, 4]) # gives [1, 2, [3, 4]]
x.extend([3, 4]) # gives [1, 2, 3, 4]
来获取年份中的整数,请参见https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-get-ordinal
ordinal
答案 2 :(得分:1)
这两个答案都不适合leap年。我在以下方面找到了成功,
function dateTimesAreSameDay(dateTime1, dateTime2) {
return dateTime1.month === dateTime2.month && dateTime1.day === dateTime2.day;
}
答案 3 :(得分:0)
文档:https://moment.github.io/luxon/#/math?id=comparing-datetimes
var DateTime = luxon.DateTime;
var d1 = DateTime.fromISO('2017-04-30');
var d2 = DateTime.fromISO('2017-04-01');
console.log(d2 < d1); //=> true
console.log(d2 > d1); //=> false
<script src="https://moment.github.io/luxon/global/luxon.min.js"></script>