Nightly Patch Machine

    java-localdatetime
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    目前版本不稳定,仍在开发中,使用请谨慎!

    日期工具库

    仿照java8的LocalDate、LocalDateTime、LocalTime,实现了java8中大部分方法、新增了许多实用的方法

    内部使用moment

    Example

    
    const localDate1 = new LocalDate();
    const localDate2 = LocalDate.of();
    const localDate3 = LocalDate.of(2021,5,20);
    const localDate4 = LocalDate.now();
    localDate3.format();
    
    方法:
        getYear(): number;
        getMonth(): number;
        getDate(): number;
        getWeekDay(): number;
        getWeek(): number;
        getTime(): number;
        weekday(num: number): LocalDate;
        getListDay(start: LocalDate, end: LocalDate): LocalDate[];
        format(pattern?: string): string;
        isSameDay(date: LocalDate): boolean;
        isBefore(date: LocalDate): boolean;
        isAfter(date: LocalDate): boolean;
        plusYear(year: number): LocalDate;
        minusYear(year: number): LocalDate;
        plusMonth(month: number): LocalDate;
        minusMonth(month: number): LocalDate;
        plusDay(day: number): LocalDate;
        minusDay(day: number): LocalDate;
        atStartOfDay(): LocalDateTime;
        toLocalDateTime(): LocalDateTime;
        atEndOfDay(): LocalDateTime;
        atStartOfMonth(): LocalDate;
        atEndOfMonth(): LocalDate;
        atStartOfWeek(): LocalDate;
        setDate(day: number): LocalDate;
        setMonth(month: number): LocalDate;
        setYear(year: number): LocalDate;
    
    const localDateTime = new LocalDateTime();
    ......
    
    const localTime = new LocalTime();
    ......
    
    

    Install

    npm i java-localdatetime

    DownloadsWeekly Downloads

    3

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    32.8 kB

    Total Files

    14

    Last publish

    Collaborators

    • mx560