changeTo method
Change a JDate instance to specified parameters. returns currently changed JDate
var specifiedDate = JDate.now().changeTo(month: 10, day: 1);
Implementation
JDate changeTo({
int? year,
int? month,
int? day,
int? hour,
int? minute,
int? second,
int? millisecond,
int? microsecond,
bool? isUtc,
}) {
final greg = jalaliToGregorian(year ?? _year, month ?? _month, day ?? _day);
var datetime;
if (isUtc ?? _isUtc) {
datetime = DateTime.utc(
greg.year,
greg.month,
greg.day,
hour ?? _hour,
minute ?? _minute,
second ?? _second,
millisecond ?? _millisecond,
microsecond ?? _microsecond,
);
} else {
datetime = DateTime(
greg.year,
greg.month,
greg.day,
hour ?? _hour,
minute ?? _minute,
second ?? _second,
millisecond ?? _millisecond,
microsecond ?? _microsecond,
);
}
_internal(datetime);
return this;
}